AtCoder Grand Contest 009

Submission #1352373

Source codeソースコード


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){
				plus += b[i]*(temp/b[i]+1) - temp;
			}

		}

		System.out.println(plus);
	}

}

Submission

Task問題 A - Multiple Array
User nameユーザ名 森崇仁
Created time投稿日時
Language言語 Java8 (OpenJDK 1.8.0)
Status状態 WA
Score得点 0
Source lengthソースコード長 547 Byte
File nameファイル名
Exec time実行時間 ms
Memory usageメモリ使用量 -

Test case

Set

Set name Score得点 / Max score Cases
Sample - s1.txt,s2.txt
All 0 / 300 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

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
01.txt WA
02.txt WA
03.txt WA
04.txt WA
05.txt WA
06.txt WA
07.txt AC 525 ms 61892 KB
08.txt WA
09.txt AC 547 ms 63568 KB
10.txt WA
11.txt AC 525 ms 83536 KB
12.txt AC 503 ms 63556 KB
13.txt WA
14.txt AC 577 ms 62196 KB
15.txt AC 96 ms 19412 KB
16.txt AC 94 ms 20948 KB
s1.txt AC 93 ms 20820 KB
s2.txt AC 94 ms 21716 KB