Submission #2410134


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]);
        }
        var ret = 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 809 Byte
Status WA
Exec Time 133 ms
Memory 16580 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
WA × 2
WA × 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 WA 129 ms 16580 KB
02.txt WA 132 ms 16576 KB
03.txt WA 128 ms 16576 KB
04.txt WA 133 ms 14528 KB
05.txt WA 129 ms 14540 KB
06.txt WA 128 ms 14532 KB
07.txt WA 109 ms 14536 KB
08.txt WA 129 ms 16576 KB
09.txt WA 110 ms 14432 KB
10.txt WA 130 ms 16576 KB
11.txt WA 107 ms 14540 KB
12.txt WA 90 ms 16480 KB
13.txt WA 113 ms 14536 KB
14.txt WA 130 ms 16576 KB
15.txt WA 20 ms 11092 KB
16.txt WA 19 ms 11092 KB
s1.txt WA 19 ms 11092 KB
s2.txt WA 19 ms 11092 KB