Submission #5494533
Source Code Expand
import java.util.*; public class Main { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int A[] = new int[N]; int B[] = new int[N]; for(int i = 0; i < N; i++) { A[i] = sc.nextInt(); B[i] = sc.nextInt(); } int ans = 0; for(int i = N - 1; i >= 0; i--) { int cnt = 0; if(A[i] % B[i] != 0) { cnt = B[i] - (A[i] % B[i]); } ans += cnt; for(int j = i - 1; j >= 0; j--) { A[j] += cnt; } } System.out.println(ans); } }
Submission Info
Submission Time | |
---|---|
Task | A - Multiple Array |
User | YK0809 |
Language | Java8 (OpenJDK 1.8.0) |
Score | 0 |
Code Size | 545 Byte |
Status | WA |
Exec Time | 1408 ms |
Memory | 76952 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 300 | ||||||
Status |
|
|
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 | 1392 ms | 63640 KB |
02.txt | WA | 1401 ms | 62216 KB |
03.txt | WA | 1388 ms | 62296 KB |
04.txt | WA | 1384 ms | 62872 KB |
05.txt | WA | 1391 ms | 61304 KB |
06.txt | WA | 1393 ms | 64680 KB |
07.txt | AC | 1331 ms | 63112 KB |
08.txt | WA | 1392 ms | 64600 KB |
09.txt | AC | 1370 ms | 62088 KB |
10.txt | WA | 1390 ms | 62148 KB |
11.txt | AC | 1328 ms | 76952 KB |
12.txt | AC | 1286 ms | 63328 KB |
13.txt | WA | 1339 ms | 61376 KB |
14.txt | AC | 1408 ms | 60908 KB |
15.txt | AC | 95 ms | 19668 KB |
16.txt | AC | 96 ms | 20688 KB |
s1.txt | AC | 95 ms | 20692 KB |
s2.txt | AC | 94 ms | 17620 KB |