結果

問題 No.333 門松列を数え上げ
ユーザー yagi2yagi2
提出日時 2017-04-20 14:25:14
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,031 bytes
コンパイル時間 2,264 ms
コンパイル使用メモリ 77,860 KB
実行使用メモリ 64,176 KB
最終ジャッジ日時 2023-09-27 03:20:55
合計ジャッジ時間 5,802 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 105 ms
56,336 KB
testcase_01 WA -
testcase_02 AC 104 ms
55,708 KB
testcase_03 TLE -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
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) {

        } else {
            for (long i = 1; i < B; i++) {
                if (isKadomatsu(A, B, i)) cnt++;
            }
        }

//        for (long i = 0; i < 2000000000; i++) {
//            if (isKadomatsu(A, B, i)) cnt++;
//        }
        System.out.println(cnt);
    }

    private static boolean isKadomatsu(long A, long B, long C) {
//        System.out.println(A + " "  + B + " " + C);
        if (A == B || A == C || B == C) {
            return false;
        }
        List<Long> num = new ArrayList<>();
        num.add(A);
        num.add(B);
        num.add(C);

        Collections.sort(num);

        return num.get(1) == A || num.get(1) == C;
    }
}
0