Submission #229356
Source Code Expand
import java.io.*; import java.math.*; import java.util.*; public class Main { public static void main(String[] args) throws Exception { new Main().solve(); } void solve() throws Exception { FastScanner in = new FastScanner(System.in); int a = in.nextInt(); int b = in.nextInt(); // String s = in.next(); // String t = in.next(); System.out.println(a % b == 0 ? 0 : b - a % b ); } // // // // // // // // // // // // class FastScanner { private InputStream _stream; private byte[] _buf = new byte[1024]; private int _curChar; private int _numChars; private StringBuilder _sb = new StringBuilder(); FastScanner(InputStream stream) { this._stream = stream; } public int read() { if (_numChars == -1) throw new InputMismatchException(); if (_curChar >= _numChars) { _curChar = 0; try { _numChars = _stream.read(_buf); } catch (IOException e) { throw new InputMismatchException(); } if (_numChars <= 0) return -1; } return _buf[_curChar++]; } public String next() { int c = read(); while (isWhitespace(c)) { c = read(); } _sb.setLength(0); do { _sb.appendCodePoint(c); c = read(); } while (!isWhitespace(c)); return _sb.toString(); } public int nextInt() { return (int) nextLong(); } public long nextLong() { int c = read(); while (isWhitespace(c)) { c = read(); } int sgn = 1; if (c == '-') { sgn = -1; c = read(); } long res = 0; do { if (c < '0' || c > '9') throw new InputMismatchException(); res *= 10; res += c - '0'; c = read(); } while (!isWhitespace(c)); return res * sgn; } public boolean isWhitespace(int c) { return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; } } } // // // // // // // // // // // // // // // // // // // // // // // // //
Submission Info
Submission Time | |
---|---|
Task | A - けんしょう先生のお菓子配り |
User | ixxa |
Language | Java (OpenJDK 1.7.0) |
Score | 100 |
Code Size | 2020 Byte |
Status | AC |
Exec Time | 305 ms |
Memory | 20552 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 100 / 100 | ||||
Status |
|
|
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 | 293 ms | 20520 KB |
subtask0_sample02.txt | AC | 285 ms | 20552 KB |
subtask0_sample03.txt | AC | 296 ms | 20528 KB |
subtask0_sample04.txt | AC | 296 ms | 20512 KB |
subtask1_01.txt | AC | 285 ms | 20416 KB |
subtask1_02.txt | AC | 305 ms | 20400 KB |
subtask1_03.txt | AC | 299 ms | 20492 KB |
subtask1_04.txt | AC | 290 ms | 20508 KB |
subtask1_05.txt | AC | 297 ms | 20512 KB |
subtask1_06.txt | AC | 298 ms | 20448 KB |
subtask1_07.txt | AC | 294 ms | 20508 KB |
subtask1_08.txt | AC | 294 ms | 20512 KB |
subtask1_09.txt | AC | 296 ms | 20524 KB |
subtask1_10.txt | AC | 292 ms | 20452 KB |
subtask1_11.txt | AC | 287 ms | 20488 KB |
subtask1_12.txt | AC | 297 ms | 20448 KB |
subtask1_13.txt | AC | 294 ms | 20460 KB |
subtask1_14.txt | AC | 293 ms | 20452 KB |