結果

問題 No.2 素因数ゲーム
ユーザー t8m8⛄️t8m8⛄️
提出日時 2015-08-12 20:00:50
言語 Java21
(openjdk 21)
結果
MLE  
実行時間 -
コード長 1,210 bytes
コンパイル時間 4,103 ms
コンパイル使用メモリ 76,520 KB
実行使用メモリ 751,708 KB
最終ジャッジ日時 2023-09-25 08:31:44
合計ジャッジ時間 19,341 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
55,744 KB
testcase_01 AC 123 ms
55,888 KB
testcase_02 AC 121 ms
55,532 KB
testcase_03 AC 124 ms
55,548 KB
testcase_04 AC 121 ms
55,384 KB
testcase_05 AC 157 ms
60,124 KB
testcase_06 AC 2,339 ms
476,308 KB
testcase_07 MLE -
testcase_08 AC 2,144 ms
488,612 KB
testcase_09 MLE -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;
import java.awt.geom.*;
import java.math.*;

public class No0002 {
	
	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[][] f = requirePrimeFactor(n);
		int x = 0;
		for (int[] y : f) {
			x ^= y[1];
		}
		out.println(x != 0 ? "Alice" : "Bob");
	}

	static int[][] requirePrimeFactor(int n) {
		if (n < 2) return null;
		int[][] ret = new int[n+1][2];
		boolean[] isPrime = new boolean[n+1];
		Arrays.fill(isPrime,true);

		int ptr = 0;
		for (int i=2; i*i<=n; i++) {
			if (!isPrime[i]) continue;
			for (int j=i*2; j<=n; j+=i) isPrime[j] = false;

			int exp = 0;
			while (n%i == 0) {
				n /= i;
				exp++;
			}
			if (exp > 0) ret[ptr++] = new int[]{i,exp};
		}

		if (n > 1) ret[ptr++] = new int[]{n,1};

		return Arrays.copyOfRange(ret,0,ptr);
	}

	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(Arrays.deepToString(o));}
}
0