Submission #3995931


Source Code Expand

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++)
            {
                if (aArray[i] % bArray[i] == 0) continue;

                long aNow = aArray[i] + cnt;
                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 Info

Submission Time
Task A - Multiple Array
User MiuraMiuMiu
Language C# (Mono 4.6.2.0)
Score 0
Code Size 1629 Byte
Status WA
Exec Time 141 ms
Memory 16600 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 2
AC × 16
WA × 2
Set Name Test Cases
Sample s1.txt, s2.txt
All 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
Case Name Status Exec Time Memory
01.txt AC 140 ms 14552 KB
02.txt AC 138 ms 14552 KB
03.txt AC 138 ms 16600 KB
04.txt AC 140 ms 14548 KB
05.txt AC 141 ms 14560 KB
06.txt AC 139 ms 14560 KB
07.txt AC 115 ms 14560 KB
08.txt AC 138 ms 16600 KB
09.txt AC 114 ms 14552 KB
10.txt AC 138 ms 14552 KB
11.txt WA 114 ms 16596 KB
12.txt AC 93 ms 14560 KB
13.txt WA 117 ms 14560 KB
14.txt AC 139 ms 14552 KB
15.txt AC 22 ms 9044 KB
16.txt AC 23 ms 13140 KB
s1.txt AC 22 ms 11220 KB
s2.txt AC 22 ms 11092 KB