Submission #2410143


Source Code Expand

using System;

public class Hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        var a = new long[n];
        var b = new long[n];
        for (int i = n - 1; i >= 0; i--)
        {
            string[] line = Console.ReadLine().Trim().Split(' ');
            a[i] = long.Parse(line[0]);
            b[i] = long.Parse(line[1]);
        }
        Console.WriteLine(getAns(a, b));
    }
    public static long getAns(long[] a, long[] b)
    {
        var n = a.Length;
        var ret = getB(a[0], b[0]);
        for (int i = 1; i < n; i++) ret += getB(a[i] + ret, b[i]);
        return ret;
    }
    public static long getB(long a, long b)
    {
        if (b >= a) return b - a;
        else return ((a + b - 1) / b) * b - a;
    }
}

Submission Info

Submission Time
Task A - Multiple Array
User bluemegane
Language C# (Mono 4.6.2.0)
Score 0
Code Size 818 Byte
Status WA
Exec Time 134 ms
Memory 16588 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 2
AC × 14
WA × 4
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 129 ms 16588 KB
02.txt AC 130 ms 14544 KB
03.txt AC 128 ms 15236 KB
04.txt AC 127 ms 14540 KB
05.txt AC 130 ms 14560 KB
06.txt AC 129 ms 16584 KB
07.txt AC 112 ms 14544 KB
08.txt AC 130 ms 14552 KB
09.txt WA 110 ms 14536 KB
10.txt AC 134 ms 16584 KB
11.txt AC 106 ms 14548 KB
12.txt WA 93 ms 16588 KB
13.txt AC 112 ms 14536 KB
14.txt AC 128 ms 16584 KB
15.txt WA 20 ms 11092 KB
16.txt WA 21 ms 11092 KB
s1.txt AC 20 ms 11092 KB
s2.txt AC 20 ms 11092 KB