結果

問題 No.2 素因数ゲーム
ユーザー t8m8⛄️t8m8⛄️
提出日時 2015-04-12 17:12:53
言語 Java21
(openjdk 21)
結果
MLE  
実行時間 -
コード長 1,248 bytes
コンパイル時間 4,896 ms
コンパイル使用メモリ 76,072 KB
実行使用メモリ 747,396 KB
最終ジャッジ日時 2023-09-17 19:43:01
合計ジャッジ時間 22,862 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
55,772 KB
testcase_01 AC 123 ms
55,296 KB
testcase_02 AC 123 ms
55,316 KB
testcase_03 AC 123 ms
55,996 KB
testcase_04 AC 123 ms
55,496 KB
testcase_05 AC 126 ms
55,988 KB
testcase_06 AC 126 ms
54,240 KB
testcase_07 AC 127 ms
55,704 KB
testcase_08 AC 427 ms
153,004 KB
testcase_09 AC 123 ms
55,576 KB
testcase_10 AC 132 ms
56,264 KB
testcase_11 AC 135 ms
59,996 KB
testcase_12 AC 125 ms
55,896 KB
testcase_13 AC 124 ms
55,868 KB
testcase_14 AC 136 ms
57,904 KB
testcase_15 AC 132 ms
56,004 KB
testcase_16 AC 133 ms
55,348 KB
testcase_17 AC 169 ms
64,620 KB
testcase_18 AC 128 ms
54,004 KB
testcase_19 MLE -
testcase_20 MLE -
testcase_21 MLE -
testcase_22 AC 427 ms
154,760 KB
testcase_23 AC 134 ms
55,536 KB
testcase_24 AC 139 ms
58,008 KB
testcase_25 AC 385 ms
124,692 KB
testcase_26 AC 127 ms
55,864 KB
testcase_27 AC 128 ms
55,908 KB
testcase_28 AC 127 ms
55,708 KB
testcase_29 AC 127 ms
55,352 KB
testcase_30 AC 130 ms
55,732 KB
権限があれば一括ダウンロードができます

ソースコード

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;
        for (int[] x : primeDecomposition(n)) {
            ans ^= x[1];
        }

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

    static ArrayList<int[]> primeDecomposition(int n) {
        ArrayList<int[]> res = new ArrayList<>();
        if (n == 1) res.add(new int[]{1,1});
        else {
            for (int i=2; i<=n; i++) {
                int cnt = 0;
                while (n%i == 0) {
                    cnt++; n /= i;
                }
                res.add(new int[]{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