結果

問題 No.333 門松列を数え上げ
ユーザー yagi2yagi2
提出日時 2017-04-20 14:45:36
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 578 bytes
コンパイル時間 2,273 ms
コンパイル使用メモリ 72,592 KB
実行使用メモリ 56,116 KB
最終ジャッジ日時 2023-09-27 03:26:25
合計ジャッジ時間 5,497 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
55,780 KB
testcase_01 WA -
testcase_02 AC 118 ms
55,680 KB
testcase_03 AC 1,257 ms
55,480 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 206 ms
55,712 KB
testcase_08 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        long A = Integer.parseInt(sc.next());
        long B = Integer.parseInt(sc.next());

        long cnt = 0;
        if (A > B) {
            for (long i = 1; i < B; i++) {
                if (i == A) continue;
                cnt++;
            }
        } else {
            for (long i = 1; i < B; i++) {
                if (i == A) continue;
                cnt++;
            }
        }

        System.out.println(cnt);
    }
}
0