Submission #1352340
Source Code Expand
import java.io.IOException; import java.util.Scanner; public class Main { public static void main(String[] args) throws IOException { Scanner in = new Scanner(System.in); int n = in.nextInt(); int[] a = new int[n]; int[] b = new int[n]; for(int i=0; i<n; i++){ a[i] = in.nextInt(); b[i] = in.nextInt(); } int plus = 0; for(int i=n-1; i>=0; i--){ if((a[i]+plus)%b[i]!=0){ plus += b[i]*((a[i]+plus)/b[i]+1) - a[i]-plus; } } System.out.println(plus); } }
Submission Info
Submission Time | |
---|---|
Task | A - Multiple Array |
User | unirita51 |
Language | Java8 (OpenJDK 1.8.0) |
Score | 0 |
Code Size | 523 Byte |
Status | WA |
Exec Time | 597 ms |
Memory | 79164 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 | 597 ms | 63876 KB |
02.txt | WA | 586 ms | 64860 KB |
03.txt | WA | 578 ms | 61368 KB |
04.txt | WA | 589 ms | 65040 KB |
05.txt | WA | 564 ms | 62240 KB |
06.txt | WA | 581 ms | 62124 KB |
07.txt | AC | 550 ms | 66816 KB |
08.txt | WA | 586 ms | 64580 KB |
09.txt | AC | 540 ms | 63444 KB |
10.txt | WA | 597 ms | 64788 KB |
11.txt | AC | 537 ms | 79164 KB |
12.txt | AC | 507 ms | 61856 KB |
13.txt | WA | 509 ms | 62064 KB |
14.txt | AC | 584 ms | 68172 KB |
15.txt | AC | 94 ms | 21204 KB |
16.txt | AC | 92 ms | 18772 KB |
s1.txt | AC | 92 ms | 18640 KB |
s2.txt | AC | 93 ms | 23764 KB |