User Tools

Site Tools


code_jam_template

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
code_jam_template [2011/04/30 04:33] – created stephencode_jam_template [2017/01/01 20:05] (current) – external edit 127.0.0.1
Line 8: Line 8:
  using System.IO;  using System.IO;
  using System.Linq;  using System.Linq;
 + 
  // Int32.MaxValue  =           2147483647 =              2 147 483 647 = 2.147 10^9  // 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  // 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  // UInt64.MaxValue = 18446744073709551615 = 18 446 744 073 709 551 615 = 1.844 10^19
 + 
  class Program  class Program
  {  {
Line 19: Line 19:
  private static int Parameter1;  private static int Parameter1;
  private static int Parameter2;  private static int Parameter2;
 + 
  static void Main(string[] args)  static void Main(string[] args)
  {  {
  Stopwatch stopwatch = new Stopwatch();  Stopwatch stopwatch = new Stopwatch();
  stopwatch.Start();  stopwatch.Start();
 + 
  string filename = "example";  string filename = "example";
 + //string filename = "small-practice";
 + //string filename = "large-practice";
  using (StreamWriter sw = new StreamWriter(filename + ".out"))  using (StreamWriter sw = new StreamWriter(filename + ".out"))
  {  {
Line 31: Line 33:
  {  {
  String line;  String line;
 + 
  // Ignore the first line.  // Ignore the first line.
  sr.ReadLine();  sr.ReadLine();
 + 
  while ((line = sr.ReadLine()) != null)  while ((line = sr.ReadLine()) != null)
  {  {
- var ints = line.Split(' ').Select(x => Int32.Parse(x)).ToArray()+ Console.WriteLine(line);
- +
- Parameter1 = ints[0]; +
- Parameter2 = ints[1];+
  
 + var input = line.Split(' ').Select(x => Int32.Parse(x)).ToArray();
 + 
 + Parameter1 = input[0];
 + Parameter2 = input[1];
 + 
  sw.Write(GetAnswer());  sw.Write(GetAnswer());
 + 
  TestCase++;  TestCase++;
  }  }
  }  }
  }  }
 + 
  stopwatch.Stop();  stopwatch.Stop();
  Console.WriteLine(stopwatch.ElapsedMilliseconds);  Console.WriteLine(stopwatch.ElapsedMilliseconds);
  }  }
 + 
  internal static string GetAnswer()  internal static string GetAnswer()
  {  {
- 
  string answer = "answer";  string answer = "answer";
  
code_jam_template.1304137987.txt.gz · Last modified: 2017/01/01 19:48 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki