Submission #229330
Source Code Expand
using System; using System.Collections.Generic; using System.Linq; class Problem { void Solve() { var sc = new Scanner(); var a = sc.Integer(); var b = sc.Integer(); for (int i = 0; i < 1000; i++) { var k = a + i; if (k % b == 0) { Console.WriteLine(i); return; } } } static void Main() { // For CodeForces #if ONLINE_JUDGE System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo("en-US"); #endif #if DEBUG var ostream = new System.IO.FileStream("debug.txt", System.IO.FileMode.Open, System.IO.FileAccess.Write); var iStream = new System.IO.FileStream("input.txt", System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.ReadWrite); Console.SetIn(new System.IO.StreamReader(iStream)); System.Diagnostics.Debug.AutoFlush = true; System.Diagnostics.Debug.Listeners.Add(new System.Diagnostics.TextWriterTraceListener(new System.IO.StreamWriter(ostream, System.Text.Encoding.UTF8))); try { #endif var problem = new Problem(); problem.Solve(); #if DEBUG } catch (Exception ex) { Console.Error.WriteLine(ex.Message); Console.WriteLine(ex.StackTrace); } Console.ReadKey(true); #endif } } public class Scanner { readonly System.IO.TextReader reader; string[] buffer = new string[0]; int position; public char[] Separator { get; set; } public Scanner(System.IO.TextReader reader = null, string separator = null) { if (reader == null) this.reader = Console.In; else this.reader = reader; if (string.IsNullOrEmpty(separator)) separator = " "; this.Separator = separator.ToCharArray(); } public string Scan() { if (this.position < this.buffer.Length) return this.buffer[this.position++]; this.buffer = this.reader.ReadLine().Split(this.Separator, StringSplitOptions.RemoveEmptyEntries); this.position = 0; return this.buffer[this.position++]; } public string[] ScanToEndLine() { if (this.position >= this.buffer.Length) return this.reader.ReadLine().Split(this.Separator, StringSplitOptions.RemoveEmptyEntries); var size = this.buffer.Length - this.position; var ar = new string[size]; Array.Copy(this.buffer, position, ar, 0, size); return ar; } public string ScanLine() { if (this.position >= this.buffer.Length) return this.reader.ReadLine(); else { var sb = new System.Text.StringBuilder(); for (; this.position < buffer.Length; this.position++) { sb.Append(this.buffer[this.position]); sb.Append(' '); } return sb.ToString(); } } public string[] ScanArray(int length) { var ar = new string[length]; for (int i = 0; i < length; i++) { ar[i] = this.Scan(); } return ar; } public int Integer() { return int.Parse(this.Scan()); } public long Long() { return long.Parse(this.Scan()); } public double Double() { return double.Parse(this.Scan()); } public int[] IntArray(int length) { var a = new int[length]; for (int i = 0; i < length; i++) a[i] = this.Integer(); return a; } public long[] LongArray(int length) { var a = new long[length]; for (int i = 0; i < length; i++) a[i] = this.Long(); return a; } public double[] DoubleArray(int length) { var a = new double[length]; for (int i = 0; i < length; i++) a[i] = this.Double(); return a; } } static public partial class EnumerableEx { static public string AsString(this IEnumerable<char> source) { return new string(source.ToArray()); } static public IEnumerable<T> Enumerate<T>(this int count, Func<int, T> selector) { return Enumerable.Range(0, count).Select(x => selector(x)); } } //*/
Submission Info
Submission Time | |
---|---|
Task | A - けんしょう先生のお菓子配り |
User | camypaper |
Language | C# (Mono 2.10.8.1) |
Score | 100 |
Code Size | 4521 Byte |
Status | AC |
Exec Time | 110 ms |
Memory | 8516 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 100 / 100 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | subtask0_sample01.txt, subtask0_sample02.txt, subtask0_sample03.txt, subtask0_sample04.txt |
All | subtask0_sample01.txt, subtask0_sample02.txt, subtask0_sample03.txt, subtask0_sample04.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask1_13.txt, subtask1_14.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
subtask0_sample01.txt | AC | 105 ms | 8496 KB |
subtask0_sample02.txt | AC | 106 ms | 8492 KB |
subtask0_sample03.txt | AC | 110 ms | 8492 KB |
subtask0_sample04.txt | AC | 108 ms | 8504 KB |
subtask1_01.txt | AC | 104 ms | 8444 KB |
subtask1_02.txt | AC | 103 ms | 8444 KB |
subtask1_03.txt | AC | 105 ms | 8492 KB |
subtask1_04.txt | AC | 105 ms | 8408 KB |
subtask1_05.txt | AC | 105 ms | 8480 KB |
subtask1_06.txt | AC | 106 ms | 8444 KB |
subtask1_07.txt | AC | 105 ms | 8496 KB |
subtask1_08.txt | AC | 102 ms | 8496 KB |
subtask1_09.txt | AC | 103 ms | 8428 KB |
subtask1_10.txt | AC | 107 ms | 8440 KB |
subtask1_11.txt | AC | 103 ms | 8516 KB |
subtask1_12.txt | AC | 105 ms | 8512 KB |
subtask1_13.txt | AC | 101 ms | 8516 KB |
subtask1_14.txt | AC | 101 ms | 8448 KB |