Submission #1113779
Source Code Expand
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int[] buttons = new int[n]; int[] mul = new int[n]; for(int i=0;i<n;i++){ buttons[i] = in.nextInt(); mul[i] = in.nextInt(); } int resevoir = 0; for(int i=mul.length-1;i>=0;i--){ int add = (buttons[i]+resevoir)%mul[i]==0?(buttons[i]+resevoir)%mul[i]:mul[i] - (buttons[i]+resevoir)%mul[i]; resevoir += add; } System.out.println(resevoir); } }
Submission Info
Submission Time | |
---|---|
Task | A - Multiple Array |
User | tienanhnguyen |
Language | Java8 (OpenJDK 1.8.0) |
Score | 0 |
Code Size | 562 Byte |
Status | WA |
Exec Time | 585 ms |
Memory | 83768 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 | 571 ms | 64664 KB |
02.txt | WA | 572 ms | 65516 KB |
03.txt | WA | 570 ms | 64136 KB |
04.txt | WA | 571 ms | 64568 KB |
05.txt | WA | 567 ms | 62004 KB |
06.txt | WA | 562 ms | 64544 KB |
07.txt | AC | 537 ms | 63760 KB |
08.txt | WA | 582 ms | 62820 KB |
09.txt | AC | 552 ms | 61772 KB |
10.txt | WA | 569 ms | 65296 KB |
11.txt | AC | 545 ms | 64868 KB |
12.txt | AC | 521 ms | 83768 KB |
13.txt | WA | 519 ms | 62364 KB |
14.txt | AC | 585 ms | 65092 KB |
15.txt | AC | 93 ms | 21588 KB |
16.txt | AC | 91 ms | 21844 KB |
s1.txt | AC | 91 ms | 18516 KB |
s2.txt | AC | 93 ms | 21972 KB |