Submission #1352357
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; int temp = 0; for(int i=n-1; i>=0; i--){ temp = a[i]+plus; if(temp%b[i]!=0 || temp==0){ plus += b[i]*(temp/b[i]+1) - temp; } System.out.println(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 | 588 Byte |
Status | WA |
Exec Time | 1174 ms |
Memory | 85560 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 | 1090 ms | 74640 KB |
02.txt | WA | 1120 ms | 76816 KB |
03.txt | WA | 1045 ms | 69480 KB |
04.txt | WA | 1087 ms | 75728 KB |
05.txt | WA | 1059 ms | 68416 KB |
06.txt | WA | 1085 ms | 71552 KB |
07.txt | WA | 1005 ms | 69384 KB |
08.txt | WA | 1067 ms | 70656 KB |
09.txt | WA | 1014 ms | 69184 KB |
10.txt | WA | 1084 ms | 74976 KB |
11.txt | WA | 1004 ms | 70232 KB |
12.txt | WA | 952 ms | 85560 KB |
13.txt | WA | 1174 ms | 79272 KB |
14.txt | WA | 1087 ms | 67352 KB |
15.txt | WA | 91 ms | 18640 KB |
16.txt | WA | 95 ms | 21332 KB |
s1.txt | WA | 94 ms | 21076 KB |
s2.txt | WA | 92 ms | 19924 KB |