結果

問題 No.2 素因数ゲーム
ユーザー jp_stejp_ste
提出日時 2016-03-04 12:02:22
言語 Java21
(openjdk 21)
結果
AC  
実行時間 123 ms / 5,000 ms
コード長 642 bytes
コンパイル時間 2,110 ms
コンパイル使用メモリ 72,008 KB
実行使用メモリ 56,392 KB
最終ジャッジ日時 2023-08-27 04:24:27
合計ジャッジ時間 7,129 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
55,820 KB
testcase_01 AC 118 ms
55,856 KB
testcase_02 AC 118 ms
55,728 KB
testcase_03 AC 118 ms
55,772 KB
testcase_04 AC 120 ms
55,740 KB
testcase_05 AC 120 ms
55,476 KB
testcase_06 AC 118 ms
56,356 KB
testcase_07 AC 118 ms
56,372 KB
testcase_08 AC 119 ms
56,128 KB
testcase_09 AC 119 ms
55,708 KB
testcase_10 AC 119 ms
55,932 KB
testcase_11 AC 121 ms
55,932 KB
testcase_12 AC 118 ms
56,392 KB
testcase_13 AC 117 ms
56,128 KB
testcase_14 AC 119 ms
55,612 KB
testcase_15 AC 117 ms
55,952 KB
testcase_16 AC 118 ms
56,108 KB
testcase_17 AC 119 ms
55,716 KB
testcase_18 AC 118 ms
56,128 KB
testcase_19 AC 119 ms
56,060 KB
testcase_20 AC 119 ms
56,176 KB
testcase_21 AC 118 ms
56,096 KB
testcase_22 AC 123 ms
55,692 KB
testcase_23 AC 117 ms
55,736 KB
testcase_24 AC 118 ms
56,224 KB
testcase_25 AC 120 ms
56,248 KB
testcase_26 AC 117 ms
55,996 KB
testcase_27 AC 117 ms
56,160 KB
testcase_28 AC 121 ms
55,576 KB
testcase_29 AC 122 ms
55,836 KB
testcase_30 AC 120 ms
56,112 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner scan = new Scanner(System.in)) {
            int N = scan.nextInt();
            int ans = 0;
            for(int i=2; i<=Math.sqrt(N); i++) {
                if(N % i == 0) {
                    int count = 0;
                    while(N % i == 0) {
                        N /= i;
                        count++;
                    }
                    ans ^= count;
                }
            }
            if(N > 1) ans ^= 1;
            
            System.out.println(ans==0? "Bob":"Alice");
        }        
    }
}
0