Submission #1350918
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--){ if((a[i] + sum) % b[i] != 0){ sum += b[i] - ((a[i] + sum) % b[i]); } } System.out.println(sum); } }
Submission Info
Submission Time | |
---|---|
Task | A - Multiple Array |
User | mosmos21 |
Language | Java8 (OpenJDK 1.8.0) |
Score | 0 |
Code Size | 465 Byte |
Status | WA |
Exec Time | 587 ms |
Memory | 65668 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 | 569 ms | 62816 KB |
02.txt | WA | 553 ms | 62636 KB |
03.txt | WA | 570 ms | 63756 KB |
04.txt | WA | 579 ms | 63152 KB |
05.txt | WA | 573 ms | 63532 KB |
06.txt | WA | 579 ms | 61652 KB |
07.txt | AC | 538 ms | 64496 KB |
08.txt | WA | 587 ms | 64984 KB |
09.txt | AC | 538 ms | 64932 KB |
10.txt | WA | 529 ms | 65620 KB |
11.txt | AC | 533 ms | 64368 KB |
12.txt | AC | 501 ms | 65272 KB |
13.txt | WA | 523 ms | 62416 KB |
14.txt | AC | 529 ms | 65668 KB |
15.txt | AC | 93 ms | 21076 KB |
16.txt | AC | 93 ms | 21712 KB |
s1.txt | AC | 91 ms | 20692 KB |
s2.txt | AC | 92 ms | 21844 KB |