Submission #1074513
Source Code Expand
//package com.grand9; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); long A[] =new long [N]; long B[] = new long [N]; for(int i=0;i<N;i++){ A[i]= sc.nextInt(); B[i]=sc.nextInt(); } long ans = 0; for(int i =N-1;i>=0;i-- ){ if(A[i]%B[i]!=0){ long plus = ((A[i]+ans)/B[i]+1)*B[i]-A[i]-ans; ans += plus; } // System.out.println(ans); } System.out.println(ans); sc.close(); } }
Submission Info
Submission Time | |
---|---|
Task | A - Multiple Array |
User | cxr1242 |
Language | Java8 (OpenJDK 1.8.0) |
Score | 0 |
Code Size | 706 Byte |
Status | WA |
Exec Time | 652 ms |
Memory | 65664 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 | AC | 604 ms | 50888 KB |
02.txt | AC | 592 ms | 49976 KB |
03.txt | AC | 644 ms | 50312 KB |
04.txt | AC | 647 ms | 50304 KB |
05.txt | AC | 612 ms | 50740 KB |
06.txt | AC | 635 ms | 50344 KB |
07.txt | AC | 585 ms | 51528 KB |
08.txt | AC | 641 ms | 50172 KB |
09.txt | AC | 596 ms | 65664 KB |
10.txt | AC | 648 ms | 50056 KB |
11.txt | WA | 601 ms | 63616 KB |
12.txt | AC | 540 ms | 60760 KB |
13.txt | WA | 567 ms | 50144 KB |
14.txt | AC | 652 ms | 50400 KB |
15.txt | AC | 130 ms | 9548 KB |
16.txt | AC | 127 ms | 9552 KB |
s1.txt | AC | 131 ms | 9672 KB |
s2.txt | AC | 126 ms | 9676 KB |