code_jam_template
Code Jam Template
namespace xxx { using System; using System.Diagnostics; using System.IO; using System.Linq; // Int32.MaxValue = 2147483647 = 2 147 483 647 = 2.147 10^9 // Int64.MaxValue = 9223372036854775807 = 9 223 372 036 854 775 807 = 9.223 10^18 // UInt64.MaxValue = 18446744073709551615 = 18 446 744 073 709 551 615 = 1.844 10^19 class Program { // Use static variables to avoid the (slight) overhead of passing them to GetAnswer() on the stack. private static int TestCase = 1; private static int Parameter1; private static int Parameter2; static void Main(string[] args) { Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); string filename = "example"; //string filename = "small-practice"; //string filename = "large-practice"; using (StreamWriter sw = new StreamWriter(filename + ".out")) { using (StreamReader sr = new StreamReader(filename + ".in")) { String line; // Ignore the first line. sr.ReadLine(); while ((line = sr.ReadLine()) != null) { Console.WriteLine(line); var input = line.Split(' ').Select(x => Int32.Parse(x)).ToArray(); Parameter1 = input[0]; Parameter2 = input[1]; sw.Write(GetAnswer()); TestCase++; } } } stopwatch.Stop(); Console.WriteLine(stopwatch.ElapsedMilliseconds); } internal static string GetAnswer() { string answer = "answer"; return string.Format("Case #{0}: {1}\n", TestCase, answer); } } }
code_jam_template.txt · Last modified: 2017/01/01 20:05 by 127.0.0.1