Submission #229381


Source Code Expand


import java.io.BufferedReader;
import java.io.InputStreamReader;

/*
 * Copyright {2014} {Matsuda Jumpei}
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
public class Main {
    private static final String TAG = Main.class.getSimpleName();

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

    public void run() throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        String line = br.readLine();
        int a = Integer.parseInt(line);

        line = br.readLine();
        int b = Integer.parseInt(line);

        int mod = a % b;
        int res = a / b;

        if (mod > 0) {
            res++;
        }

        int req = res * b - a;
        printAnswer(String.valueOf(req));
    }

    private void printAnswer(String a) {
        System.out.println(a);
    }
}

Submission Info

Submission Time
Task A - けんしょう先生のお菓子配り
User jkojm23
Language Java (OpenJDK 1.7.0)
Score 100
Code Size 1463 Byte
Status AC
Exec Time 348 ms
Memory 20712 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 305 ms 20712 KB
subtask0_sample02.txt AC 307 ms 20580 KB
subtask0_sample03.txt AC 316 ms 20536 KB
subtask0_sample04.txt AC 326 ms 20524 KB
subtask1_01.txt AC 305 ms 20612 KB
subtask1_02.txt AC 325 ms 20528 KB
subtask1_03.txt AC 327 ms 20560 KB
subtask1_04.txt AC 304 ms 20524 KB
subtask1_05.txt AC 338 ms 20612 KB
subtask1_06.txt AC 348 ms 20560 KB
subtask1_07.txt AC 324 ms 20636 KB
subtask1_08.txt AC 313 ms 20528 KB
subtask1_09.txt AC 324 ms 20640 KB
subtask1_10.txt AC 307 ms 20664 KB
subtask1_11.txt AC 324 ms 20624 KB
subtask1_12.txt AC 308 ms 20632 KB
subtask1_13.txt AC 308 ms 20656 KB
subtask1_14.txt AC 321 ms 20588 KB