Submission #1350913


Source Code Expand

import java.util.Scanner;

public class Main {
	static Scanner in = new Scanner(System.in);
	
	public static void main(String[] args){
		int n = in.nextInt();
		int[] a = new int[n], b = new int[n];
		for(int i = 0; i < n; i++){
			a[i] = in.nextInt();
			b[i] = in.nextInt();
		}
		int sum = 0;
		for(int i = n - 1; i > -1; i--){
			int j = 0;
			while((a[i] + sum + j) % b[i] != 0){
				j++;
			}
			sum += j;
		}
		System.out.println(sum);
	}
}

Submission Info

Submission Time
Task A - Multiple Array
User mosmos21
Language Java8 (OpenJDK 1.8.0)
Score 0
Code Size 469 Byte
Status TLE
Exec Time 2109 ms
Memory 83412 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 2
AC × 9
TLE × 9
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 TLE 2109 ms 64948 KB
02.txt TLE 2109 ms 64496 KB
03.txt TLE 2109 ms 63512 KB
04.txt TLE 2109 ms 63324 KB
05.txt TLE 2109 ms 61260 KB
06.txt TLE 2109 ms 63196 KB
07.txt AC 560 ms 61636 KB
08.txt TLE 2109 ms 64736 KB
09.txt AC 537 ms 65480 KB
10.txt TLE 2109 ms 59396 KB
11.txt AC 531 ms 66532 KB
12.txt AC 482 ms 83412 KB
13.txt TLE 2109 ms 62796 KB
14.txt AC 564 ms 63116 KB
15.txt AC 92 ms 21716 KB
16.txt AC 90 ms 21844 KB
s1.txt AC 94 ms 19540 KB
s2.txt AC 91 ms 19796 KB