結果

問題 No.128 お年玉(1)
ユーザー MoominPazMoominPaz
提出日時 2015-10-04 08:19:26
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 748 bytes
コンパイル時間 2,428 ms
コンパイル使用メモリ 74,632 KB
実行使用メモリ 58,064 KB
最終ジャッジ日時 2024-04-08 18:21:06
合計ジャッジ時間 6,353 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 135 ms
57,956 KB
testcase_01 AC 136 ms
57,984 KB
testcase_02 AC 131 ms
57,972 KB
testcase_03 WA -
testcase_04 AC 137 ms
57,576 KB
testcase_05 AC 135 ms
57,644 KB
testcase_06 AC 137 ms
57,568 KB
testcase_07 AC 136 ms
57,676 KB
testcase_08 AC 139 ms
57,796 KB
testcase_09 AC 140 ms
57,780 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
    long N;
    long M;
    long Dist;
    long Digit;
    long Divide;
    Scanner sc = new Scanner(System.in);
    public static void main(String[] args) {
        new Main().solve();
    }

    void solve() {
        N = sc.nextLong();
        M = sc.nextLong();
        Dist = N / M;
        Digit = (long)Math.log10(Dist) + 1;
        Divide = 1;
        for(int i = 0; i < Digit - 1; i ++) {
            Divide = Divide * 10;
        }
        Dist = (Dist / Divide) * Divide;
        if(Dist < 1000) {
            System.out.println(0);
        } else {
            while(Dist * M > N) {
                Dist = Dist - 1000;
            }
            System.out.println(Dist);
        }
    }
}
0