Submission #2410261


Source Code Expand

using System;

public class Hello
{
    public static void Main()
    {
        var n = long.Parse(Console.ReadLine().Trim());
        var a = new long[n];
        var b = new long[n];
        for (long 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 (long 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 821 Byte
Status WA
Exec Time 136 ms
Memory 17284 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 17284 KB
02.txt AC 134 ms 16584 KB
03.txt AC 128 ms 14548 KB
04.txt AC 130 ms 15236 KB
05.txt AC 130 ms 16592 KB
06.txt AC 131 ms 14532 KB
07.txt AC 111 ms 16584 KB
08.txt AC 130 ms 15236 KB
09.txt WA 110 ms 14544 KB
10.txt AC 136 ms 16584 KB
11.txt AC 113 ms 15244 KB
12.txt WA 91 ms 14540 KB
13.txt AC 111 ms 16584 KB
14.txt AC 134 ms 14532 KB
15.txt WA 20 ms 9044 KB
16.txt WA 20 ms 11092 KB
s1.txt AC 20 ms 9044 KB
s2.txt AC 20 ms 11092 KB