結果

問題 No.2 素因数ゲーム
ユーザー t8m8⛄️t8m8⛄️
提出日時 2015-04-12 16:45:20
言語 Java21
(openjdk 21)
結果
AC  
実行時間 2,417 ms / 5,000 ms
コード長 1,272 bytes
コンパイル時間 3,500 ms
コンパイル使用メモリ 74,680 KB
実行使用メモリ 157,624 KB
最終ジャッジ日時 2023-08-27 03:48:23
合計ジャッジ時間 27,681 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
55,732 KB
testcase_01 AC 122 ms
55,860 KB
testcase_02 AC 124 ms
56,084 KB
testcase_03 AC 124 ms
56,036 KB
testcase_04 AC 126 ms
56,100 KB
testcase_05 AC 138 ms
56,156 KB
testcase_06 AC 190 ms
71,004 KB
testcase_07 AC 212 ms
73,416 KB
testcase_08 AC 267 ms
71,260 KB
testcase_09 AC 240 ms
157,624 KB
testcase_10 AC 1,377 ms
141,216 KB
testcase_11 AC 714 ms
98,304 KB
testcase_12 AC 230 ms
97,864 KB
testcase_13 AC 440 ms
139,164 KB
testcase_14 AC 183 ms
62,008 KB
testcase_15 AC 401 ms
81,280 KB
testcase_16 AC 945 ms
116,528 KB
testcase_17 AC 1,732 ms
142,744 KB
testcase_18 AC 1,180 ms
149,520 KB
testcase_19 AC 1,304 ms
110,232 KB
testcase_20 AC 1,666 ms
128,928 KB
testcase_21 AC 2,417 ms
152,928 KB
testcase_22 AC 1,990 ms
144,884 KB
testcase_23 AC 697 ms
99,992 KB
testcase_24 AC 1,648 ms
151,856 KB
testcase_25 AC 1,556 ms
126,744 KB
testcase_26 AC 617 ms
106,228 KB
testcase_27 AC 361 ms
85,660 KB
testcase_28 AC 577 ms
112,376 KB
testcase_29 AC 462 ms
101,748 KB
testcase_30 AC 682 ms
100,180 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 x = n, ans = 0;
        boolean[] isPrime = new boolean[n+1];
        fill(isPrime,true);
        isPrime[0] = isPrime[1] = false;
        for (int i=2; i<=n; i++) {
            if (isPrime[i]) {
                int cnt = 0;
                while (x%i == 0 && x > 1) {
                    x /= i;
                    cnt++;
                }
                ans ^= cnt;
                if (x == 1) break;
                for (int j=i+i; j<=n; j+=i) {
                    isPrime[j] = false;
                }
            }
        }
        out.println(ans!=0?"Alice":"Bob");
    }

    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