結果

問題 No.2 素因数ゲーム
ユーザー DAZYDAZY
提出日時 2017-05-15 23:26:32
言語 Java19
(openjdk 21)
結果
AC  
実行時間 607 ms / 5,000 ms
コード長 687 bytes
コンパイル時間 3,229 ms
コンパイル使用メモリ 72,392 KB
実行使用メモリ 56,220 KB
最終ジャッジ日時 2023-08-27 04:41:22
合計ジャッジ時間 9,422 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
55,564 KB
testcase_01 AC 122 ms
55,628 KB
testcase_02 AC 125 ms
55,956 KB
testcase_03 AC 124 ms
55,680 KB
testcase_04 AC 124 ms
55,980 KB
testcase_05 AC 122 ms
55,716 KB
testcase_06 AC 123 ms
55,568 KB
testcase_07 AC 123 ms
55,932 KB
testcase_08 AC 143 ms
56,020 KB
testcase_09 AC 125 ms
55,732 KB
testcase_10 AC 125 ms
55,488 KB
testcase_11 AC 123 ms
55,740 KB
testcase_12 AC 126 ms
56,076 KB
testcase_13 AC 124 ms
56,220 KB
testcase_14 AC 124 ms
55,748 KB
testcase_15 AC 125 ms
55,464 KB
testcase_16 AC 127 ms
56,092 KB
testcase_17 AC 133 ms
55,796 KB
testcase_18 AC 125 ms
55,908 KB
testcase_19 AC 397 ms
56,000 KB
testcase_20 AC 314 ms
55,736 KB
testcase_21 AC 607 ms
56,088 KB
testcase_22 AC 142 ms
56,056 KB
testcase_23 AC 122 ms
55,472 KB
testcase_24 AC 126 ms
55,828 KB
testcase_25 AC 136 ms
55,792 KB
testcase_26 AC 124 ms
55,996 KB
testcase_27 AC 123 ms
55,824 KB
testcase_28 AC 120 ms
55,996 KB
testcase_29 AC 124 ms
55,832 KB
testcase_30 AC 124 ms
55,764 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

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

        String ans = "Alice";
        long N = scan.nextLong();
        //xor:排他的論理和
        int xor = 0;
        int count = 0;
        long div = 3;

        while (N % 2 == 0) {
            N /= 2;
            count++;
        }
        xor ^= count;
        while (N != 1) {
            count = 0;
            while (N % div == 0) {
                N /= div;
                count++;
            }
            xor ^= count;
            div += 2;
        }
        if (xor == 0) ans = "Bob";

        System.out.print(ans);
    }
}
0