Exemple #1
0
        static void Main(string[] args)
        {
            TextReader tr = new StreamReader(@"C:\Google Code Jam\C-large.in");
            TextWriter tw = new StreamWriter(@"C:\Google Code Jam\C-large.txt");

            ProblemC.Solve(tr, tw);
            tr.Close(); tw.Close();
            Console.ReadKey();
        }
Exemple #2
0
        public static void Solve(TextReader tr, TextWriter tw)
        {
            int L = int.Parse(tr.ReadLine());

            for (int i = 1; i <= L; i++)
            {
                string[] s  = tr.ReadLine().Split(' ');
                int      P  = int.Parse(s[0]);
                int      Q  = int.Parse(s[1]);
                int[]    pr = new int[Q + 2];
                s = tr.ReadLine().Split(' ');
                for (int j = 0; j < Q; j++)
                {
                    pr[j + 1] = int.Parse(s[j]);
                }
                pr[0]     = 0;
                pr[Q + 1] = P + 1;
                ProblemC problem = new ProblemC(P, Q, pr);
                tw.WriteLine("Case #{0}: {1}", i, problem.Calc());
            }
        }