Submission #229357


Source Code Expand

import java.util.Arrays;
import java.util.Scanner;

public class Main {
	MyScanner sc = new MyScanner();
	Scanner sc2 = new Scanner(System.in);
	final int MOD = 1000000007;
	int[] dx = { 1, 0, 0, -1 };
	int[] dy = { 0, 1, -1, 0 };

	void run() {
		int a = sc.nextInt();
		int b = sc.nextInt();
		if (a % b == 0) {
			System.out.println(0);
		} else {
			System.out.println(b - (a % b));
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}

	void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

	void debug2(int[][] array) {
		for (int i = 0; i < array.length; i++) {
			for (int j = 0; j < array[i].length; j++) {
				System.out.print(array[i][j]);
			}
			System.out.println();
		}
	}

	class MyScanner {
		int nextInt() {
			try {
				int c = System.in.read();
				while (c != '-' && (c < '0' || '9' < c))
					c = System.in.read();
				if (c == '-')
					return -nextInt();
				int res = 0;
				do {
					res *= 10;
					res += c - '0';
					c = System.in.read();
				} while ('0' <= c && c <= '9');
				return res;
			} catch (Exception e) {
				return -1;
			}
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		String next() {
			try {
				StringBuilder res = new StringBuilder("");
				int c = System.in.read();
				while (Character.isWhitespace(c))
					c = System.in.read();
				do {
					res.append((char) c);
				} while (!Character.isWhitespace(c = System.in.read()));
				return res.toString();
			} catch (Exception e) {
				return null;
			}
		}
	}
}

Submission Info

Submission Time
Task A - けんしょう先生のお菓子配り
User suigingin
Language Java (OpenJDK 1.7.0)
Score 100
Code Size 1673 Byte
Status AC
Exec Time 458 ms
Memory 23252 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 100 / 100
Status
AC × 4
AC × 18
Set Name Test Cases
Sample subtask0_sample01.txt, subtask0_sample02.txt, subtask0_sample03.txt, subtask0_sample04.txt
All subtask0_sample01.txt, subtask0_sample02.txt, subtask0_sample03.txt, subtask0_sample04.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask1_13.txt, subtask1_14.txt
Case Name Status Exec Time Memory
subtask0_sample01.txt AC 436 ms 23036 KB
subtask0_sample02.txt AC 436 ms 23108 KB
subtask0_sample03.txt AC 436 ms 23088 KB
subtask0_sample04.txt AC 442 ms 23144 KB
subtask1_01.txt AC 426 ms 23168 KB
subtask1_02.txt AC 440 ms 23076 KB
subtask1_03.txt AC 430 ms 23160 KB
subtask1_04.txt AC 422 ms 23060 KB
subtask1_05.txt AC 438 ms 23156 KB
subtask1_06.txt AC 453 ms 23092 KB
subtask1_07.txt AC 458 ms 23096 KB
subtask1_08.txt AC 430 ms 23084 KB
subtask1_09.txt AC 428 ms 23096 KB
subtask1_10.txt AC 429 ms 23068 KB
subtask1_11.txt AC 425 ms 23180 KB
subtask1_12.txt AC 437 ms 23132 KB
subtask1_13.txt AC 426 ms 23252 KB
subtask1_14.txt AC 445 ms 23056 KB