結果

問題 No.2 素因数ゲーム
ユーザー DAZYDAZY
提出日時 2017-05-15 21:52:51
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 871 bytes
コンパイル時間 6,522 ms
コンパイル使用メモリ 72,340 KB
実行使用メモリ 56,408 KB
最終ジャッジ日時 2023-10-14 13:27:52
合計ジャッジ時間 12,802 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
55,948 KB
testcase_01 AC 126 ms
55,660 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 125 ms
55,932 KB
testcase_05 AC 123 ms
56,072 KB
testcase_06 AC 125 ms
55,740 KB
testcase_07 WA -
testcase_08 AC 143 ms
55,664 KB
testcase_09 AC 126 ms
55,404 KB
testcase_10 AC 125 ms
55,652 KB
testcase_11 AC 125 ms
55,836 KB
testcase_12 AC 126 ms
55,896 KB
testcase_13 AC 124 ms
56,084 KB
testcase_14 AC 126 ms
55,684 KB
testcase_15 AC 125 ms
55,664 KB
testcase_16 AC 126 ms
55,784 KB
testcase_17 AC 134 ms
55,416 KB
testcase_18 AC 126 ms
56,012 KB
testcase_19 AC 408 ms
55,924 KB
testcase_20 AC 315 ms
56,028 KB
testcase_21 AC 631 ms
55,400 KB
testcase_22 AC 144 ms
55,440 KB
testcase_23 AC 128 ms
55,660 KB
testcase_24 AC 124 ms
55,660 KB
testcase_25 AC 141 ms
55,848 KB
testcase_26 AC 127 ms
55,740 KB
testcase_27 AC 126 ms
55,688 KB
testcase_28 AC 126 ms
55,596 KB
testcase_29 AC 123 ms
55,852 KB
testcase_30 AC 125 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();
        //count1:Nを構成する素因数の種類の数 count2:Nを構成する素因数の総数
        int count1 = 0;
        int count2 = 0;
        long div = 3;
        
        while (N % 2 == 0) {
            N /= 2;
            count2++;
        }
        if (count2 != 0) count1 = 1;
        while (N != 1) {
            if (N % div == 0) {
                count1++;
                do {
                    N /= div;
                    count2++;
                } while (N % div == 0);
            }
            div += 2;
        }
        if (count1 % 2 != 0) {}
        else if (count2 % 2 == 0) ans = "Bob";


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