結果

問題 No.2 素因数ゲーム
ユーザー t8m8⛄️t8m8⛄️
提出日時 2015-04-12 17:02:07
言語 Java21
(openjdk 21)
結果
TLE  
実行時間 -
コード長 1,292 bytes
コンパイル時間 4,933 ms
コンパイル使用メモリ 76,392 KB
実行使用メモリ 273,352 KB
最終ジャッジ日時 2023-09-17 19:41:09
合計ジャッジ時間 16,466 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
55,848 KB
testcase_01 AC 124 ms
55,688 KB
testcase_02 AC 126 ms
55,488 KB
testcase_03 AC 128 ms
55,716 KB
testcase_04 AC 128 ms
55,392 KB
testcase_05 AC 126 ms
56,068 KB
testcase_06 AC 129 ms
55,592 KB
testcase_07 AC 128 ms
55,620 KB
testcase_08 AC 921 ms
273,352 KB
testcase_09 AC 128 ms
54,152 KB
testcase_10 AC 157 ms
58,160 KB
testcase_11 AC 174 ms
57,876 KB
testcase_12 AC 127 ms
55,928 KB
testcase_13 AC 126 ms
55,348 KB
testcase_14 AC 179 ms
57,596 KB
testcase_15 AC 162 ms
56,068 KB
testcase_16 AC 159 ms
58,052 KB
testcase_17 AC 271 ms
77,924 KB
testcase_18 AC 130 ms
55,756 KB
testcase_19 TLE -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

//No.2 素因数ゲーム

import java.util.*;
import java.io.*;
import static java.util.Arrays.*;
import static java.lang.Math.*;

public class No2 {
    
    static final Scanner in = new Scanner(System.in);
    static final PrintWriter out = new PrintWriter(System.out,false);

    static void solve() {
        int n = in.nextInt();
        int ans = 0;
        HashMap<Long,Integer> map = primeDecomposition(n);
        for (Long x : map.keySet()) {
            ans ^= map.get(x);
        }

        out.println(ans!=0?"Alice":"Bob");
    }

    static HashMap<Long,Integer> primeDecomposition(long n) {
        HashMap<Long,Integer> res = new HashMap<>();
        if (n == 1) res.put(1L,1);
        else {
            for (long i=2; i<=n; i++) {
                int cnt = 0;
                while (n%i == 0) {
                    cnt++; n /= i;
                }
                res.put(i,cnt);
            }
        }
        return res;
    }

    public static void main(String[] args) {
        long start = System.currentTimeMillis();

        solve();
        out.flush();

        long end = System.currentTimeMillis();
        //trace(end-start + "ms");
        in.close();
        out.close();
    }

    static void trace(Object... o) { System.out.println(deepToString(o));}
}
0