Example #1
0
        static void Main(string[] args)
        {
            StreamReader sr = null;
            StreamWriter sw = null;
            Env env = new Env();

            try
            {
                sr = new StreamReader(
                    args[0], Encoding.GetEncoding("Shift_JIS"));
                env.sr = sr;
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            try
            {
                sw = new StreamWriter(
                    args[1], false, Encoding.GetEncoding("Shift_JIS"));
                env.sw = sw;
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            pcLoop(env);

            sw.Close();
        }
Example #2
0
        static void pcCore(long t, Env env)
        {
            uint a;
            uint b;
            {
                string line = env.sr.ReadLine();
                string[] parts = line.Split(Env.delim, StringSplitOptions.None);
                a = UInt32.Parse(parts[0]);
                b = UInt32.Parse(parts[1]);
            }

            uint res = 0;
            Dictionary<uint, uint> dict = new Dictionary<uint, uint>();
            uint keta = msdKeta(b);

            for (uint i = a; i <= b; i++)
            {
                res = res + pcCoreSub(i, a, b, keta, dict);
            }
            env.sw.WriteLine("Case #{0}: {1}", t, res);
        }
Example #3
0
 static void pcLoop(Env env)
 {
     string line = env.sr.ReadLine();
     long t = Int64.Parse(line);
     for (long i = 1; i <= t; i++)
     {
         pcCore(i, env);
     }
 }