AtCoder Grand Contest 009

Submission #3995938

Source codeソースコード

using System;
using System.Collections.Generic;
using System.Text;

namespace AtTest.AGC_Challenge
{
    class _009_A
    {
        static void Main(string[] args)
        {
            Method(args);
            Console.ReadLine();
        }

        static void Method(string[] args)
        {
            int n = ReadInt();
            var aArray = new long[n];
            var bArray = new long[n];
            for(int i = 0; i < n; i++)
            {
                int[] ab = ReadInts();
                aArray[i] = ab[0];
                bArray[i] = ab[1];
            }
            Array.Reverse(aArray);
            Array.Reverse(bArray);
            long cnt = 0;
            for(int i = 0; i < n; i++)
            {
                long aNow = aArray[i] + cnt;
                if (aNow % bArray[i] == 0) continue;

                long dest = (aNow / bArray[i] + 1) * bArray[i];
                cnt += dest - aNow;
            }
            Console.WriteLine(cnt);
        }

        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}

Submission

Task問題 A - Multiple Array
User nameユーザ名 MiuraMiuMiu
Created time投稿日時
Language言語 C# (Mono 4.6.2.0)
Status状態 AC
Score得点 300
Source lengthソースコード長 1624 Byte
File nameファイル名
Exec time実行時間 141 ms
Memory usageメモリ使用量 17292 KB

Test case

Set

Set name Score得点 / Max score Cases
Sample - s1.txt,s2.txt
All 300 / 300 01.txt,02.txt,03.txt,04.txt,05.txt,06.txt,07.txt,08.txt,09.txt,10.txt,11.txt,12.txt,13.txt,14.txt,15.txt,16.txt,s1.txt,s2.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
01.txt AC 137 ms 16596 KB
02.txt AC 138 ms 14560 KB
03.txt AC 136 ms 14548 KB
04.txt AC 137 ms 14552 KB
05.txt AC 138 ms 14548 KB
06.txt AC 137 ms 14548 KB
07.txt AC 115 ms 16600 KB
08.txt AC 141 ms 14560 KB
09.txt AC 115 ms 17292 KB
10.txt AC 138 ms 16600 KB
11.txt AC 113 ms 17292 KB
12.txt AC 92 ms 14548 KB
13.txt AC 115 ms 16596 KB
14.txt AC 140 ms 16600 KB
15.txt AC 22 ms 11092 KB
16.txt AC 22 ms 9172 KB
s1.txt AC 22 ms 9044 KB
s2.txt AC 22 ms 11220 KB