Submission #1262319
Source Code Expand
using System; using System.Collections.Generic; //using System.Drawing; using System.Globalization; using System.IO; using System.Linq; using System.Text; //using System.Threading; namespace ReadWriteTemplate { public static class Solver { private static void SolveCase() { long a = ReadLong(); long b = ReadLong(); long c = ReadLong(); int ans = 0; for (int i = 0; i < 1000000; i++) { if (a % 2 == 1 || b % 2 == 1 || c % 2 == 1) { Writer.WriteLine(ans); return; } long ta = b / 2 + c / 2; long tb = a / 2 + c / 2; long tc = a / 2 + b / 2; a = ta; b = tb; c = tc; ans++; } Writer.WriteLine(-1); } public static void Solve() { //int T = ReadInt(); //for (int i = 0; i < T; i++) { //Writer.Write("Case #{0}: ", i + 1); SolveCase(); } } public static void Main() { //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; #if DEBUG Reader = File.OpenText("input.txt"); Writer = File.CreateText("output.txt"); #else Reader = Console.In; Writer = Console.Out; #endif //Reader = File.OpenText("concatenation.in"); Writer = File.CreateText("concatenation.out"); Solve(); Reader.Close(); Writer.Close(); } public static IOrderedEnumerable<TSource> OrderByWithShuffle<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector) { return source.Shuffle().OrderBy(keySelector); } public static T[] Shuffle<T>(this IEnumerable<T> source) { T[] result = source.ToArray(); Random rnd = new Random(); for (int i = result.Length - 1; i >= 1; i--) { int k = rnd.Next(i + 1); T tmp = result[k]; result[k] = result[i]; result[i] = tmp; } return result; } #region Read/Write private static TextReader Reader; private static TextWriter Writer; private static Queue<string> CurrentLineTokens = new Queue<string>(); private static string[] ReadAndSplitLine() { return Reader.ReadLine().Split(new[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries); } public static string ReadToken() { while (CurrentLineTokens.Count == 0) CurrentLineTokens = new Queue<string>(ReadAndSplitLine()); return CurrentLineTokens.Dequeue(); } public static string ReadLine() { return Reader.ReadLine(); } public static int ReadInt() { return int.Parse(ReadToken()); } public static long ReadLong() { return long.Parse(ReadToken()); } public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); } public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); } public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); } public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); } public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = ReadIntArray(); return matrix; } public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++) lines[i] = Reader.ReadLine().Trim(); return lines; } public static void WriteArray<T>(IEnumerable<T> array) { Writer.WriteLine(string.Join(" ", array)); } #endregion } }
Submission Info
Submission Time | |
---|---|
Task | A - Cookie Exchanges |
User | Umbra |
Language | C# (Mono 4.6.2.0) |
Score | 300 |
Code Size | 4651 Byte |
Status | AC |
Exec Time | 83 ms |
Memory | 13396 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample1.txt, sample2.txt, sample3.txt |
All | sample1.txt, sample2.txt, sample3.txt, in1.txt, in10.txt, in11.txt, in2.txt, in3.txt, in4.txt, in5.txt, in6.txt, in7.txt, in8.txt, in9.txt, sample1.txt, sample2.txt, sample3.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
in1.txt | AC | 22 ms | 11348 KB |
in10.txt | AC | 22 ms | 11348 KB |
in11.txt | AC | 83 ms | 13396 KB |
in2.txt | AC | 22 ms | 9300 KB |
in3.txt | AC | 22 ms | 11220 KB |
in4.txt | AC | 23 ms | 11220 KB |
in5.txt | AC | 23 ms | 13268 KB |
in6.txt | AC | 22 ms | 11220 KB |
in7.txt | AC | 23 ms | 11220 KB |
in8.txt | AC | 23 ms | 11220 KB |
in9.txt | AC | 83 ms | 9300 KB |
sample1.txt | AC | 22 ms | 11348 KB |
sample2.txt | AC | 83 ms | 9300 KB |
sample3.txt | AC | 23 ms | 11348 KB |