Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            string inputname = args[0];
            string outputname = args[1];

            string[] lines = File.ReadAllLines(inputname);

            int ncases = int.Parse(lines[0]);
            int nline = 0;
            IList<string> results = new List<string>();
            Paint paint = new Paint();

            for (int k = 0; k < ncases; k++)
            {
                System.Console.WriteLine(string.Format("Solving Case #{0}", k + 1));
                nline++;
                string[] numbers = lines[nline].Split(' ');
                long radius = long.Parse(numbers[0]);
                long pnt = long.Parse(numbers[1]);
                long result = paint.CountFor(radius, pnt);
                results.Add(string.Format("Case #{0}: {1}", k + 1, result));
            }

            File.WriteAllLines(outputname, results.ToArray());
        }
Ejemplo n.º 2
0
        public void CountForRadiusThreePaintForty()
        {
            Paint paint = new Paint();

            Assert.AreEqual(3, paint.CountFor(3, 40));
        }
Ejemplo n.º 3
0
        public void CountForRadiusOnePaintTen()
        {
            Paint paint = new Paint();

            Assert.AreEqual(2, paint.CountFor(1, 10));
        }
Ejemplo n.º 4
0
        public void CountForRadiusOnePaintNine()
        {
            Paint paint = new Paint();

            Assert.AreEqual(1, paint.CountFor(1, 9));
        }
Ejemplo n.º 5
0
        public void CountForRadiusOnePaint1000000000000000000()
        {
            Paint paint = new Paint();

            Assert.AreEqual(707106780, paint.CountFor(1, 1000000000000000000));
        }
Ejemplo n.º 6
0
        public void CountForRadius10000000000000000Paint1000000000000000000()
        {
            Paint paint = new Paint();

            Assert.AreEqual(49, paint.CountFor(10000000000000000, 1000000000000000000));
        }