結果

問題 No.415 ぴょん
ユーザー 41Toame41Toame
提出日時 2018-04-25 15:25:55
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 604 bytes
コンパイル時間 4,027 ms
コンパイル使用メモリ 73,228 KB
実行使用メモリ 56,288 KB
最終ジャッジ日時 2023-09-10 05:27:44
合計ジャッジ時間 8,551 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
55,764 KB
testcase_01 AC 123 ms
55,772 KB
testcase_02 AC 124 ms
55,816 KB
testcase_03 AC 121 ms
55,976 KB
testcase_04 AC 121 ms
55,564 KB
testcase_05 AC 125 ms
56,000 KB
testcase_06 WA -
testcase_07 AC 125 ms
55,912 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 124 ms
55,660 KB
testcase_11 WA -
testcase_12 AC 121 ms
56,028 KB
testcase_13 AC 127 ms
55,768 KB
testcase_14 AC 123 ms
55,568 KB
testcase_15 AC 124 ms
55,868 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 125 ms
55,968 KB
testcase_21 AC 122 ms
55,704 KB
testcase_22 AC 123 ms
56,288 KB
testcase_23 WA -
testcase_24 AC 123 ms
55,788 KB
testcase_25 AC 123 ms
55,740 KB
testcase_26 AC 122 ms
55,820 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class T02 {
    /*
    int gcd(int a, int b) {
        if ( b > a) return gcd(b, a);
        else if (b == 0) return a;
        eklse
        */
    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int D = sc.nextInt();
        if ( N / 2 < D) {
            D = N - D;
        }
        if (D == 0) {
            System.out.println(0);
        }
        else if (N % D == 0) {
            System.out.println(N / D - 1);
        } else {
            System.out.println(N - 1);
        }

    }

}
0