Submission #1226187


Source Code Expand

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AGC009MultipleArray
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            long[] A = new long[N];
            long[] B = new long[N];
            string[] vals;
            for (int i=0; i < N; i++)
            {
                vals = Console.ReadLine().Split(' ');
                A[i] = long.Parse(vals[0]);
                B[i] = long.Parse(vals[1]);
            }

            long push = 0;
            long t;
            for(int i = N-1; i >= 0; i--)
            {
                A[i] += push;
                t = (A[i] / B[i]);
                if (A[i] % B[i] != 0)
                    t++;
                push += t * B[i] - A[i];
            }

            Console.WriteLine(push);
        }
    }
}

Submission Info

Submission Time
Task A - Multiple Array
User hogeki
Language C# (Mono 4.6.2.0)
Score 300
Code Size 962 Byte
Status AC
Exec Time 131 ms
Memory 17292 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 2
AC × 18
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 127 ms 16584 KB
02.txt AC 127 ms 14540 KB
03.txt AC 126 ms 16584 KB
04.txt AC 127 ms 14548 KB
05.txt AC 129 ms 16600 KB
06.txt AC 131 ms 14552 KB
07.txt AC 109 ms 17292 KB
08.txt AC 129 ms 15236 KB
09.txt AC 113 ms 14552 KB
10.txt AC 128 ms 16588 KB
11.txt AC 112 ms 16584 KB
12.txt AC 89 ms 16588 KB
13.txt AC 107 ms 14540 KB
14.txt AC 130 ms 14536 KB
15.txt AC 20 ms 9044 KB
16.txt AC 20 ms 11092 KB
s1.txt AC 20 ms 9044 KB
s2.txt AC 20 ms 13140 KB