Submission #5415952
Source Code Expand
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner stdIn=new Scanner(System.in); int N=stdIn.nextInt(); int A[]=new int[N]; int B[]=new int[N]; int z=0,sum=0,y=0; while(z<N){ A[z]=stdIn.nextInt(); B[z]=stdIn.nextInt(); z++; }z--; while(z>=0) { A[z]+=sum; while(true) { if(A[z]%B[z]==0) break; y=A[z]/B[z]+1; sum+=y*B[z]-A[z]; A[z]=y*B[z]; } z--; } System.out.println(sum); } }
Submission Info
Submission Time | |
---|---|
Task | A - Multiple Array |
User | zaki1236 |
Language | Java8 (OpenJDK 1.8.0) |
Score | 0 |
Code Size | 512 Byte |
Status | WA |
Exec Time | 602 ms |
Memory | 84264 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 | 563 ms | 60520 KB |
02.txt | WA | 602 ms | 63060 KB |
03.txt | WA | 574 ms | 84264 KB |
04.txt | WA | 569 ms | 64220 KB |
05.txt | WA | 571 ms | 63688 KB |
06.txt | WA | 589 ms | 64668 KB |
07.txt | AC | 532 ms | 64888 KB |
08.txt | WA | 556 ms | 63868 KB |
09.txt | AC | 527 ms | 63776 KB |
10.txt | WA | 601 ms | 64972 KB |
11.txt | AC | 535 ms | 61592 KB |
12.txt | AC | 501 ms | 64060 KB |
13.txt | WA | 503 ms | 62396 KB |
14.txt | AC | 573 ms | 64092 KB |
15.txt | AC | 93 ms | 21716 KB |
16.txt | AC | 94 ms | 19540 KB |
s1.txt | AC | 91 ms | 18516 KB |
s2.txt | AC | 94 ms | 21844 KB |