結果
| 問題 |
No.2 素因数ゲーム
|
| コンテスト | |
| ユーザー |
t8m8⛄️
|
| 提出日時 | 2015-04-12 17:12:53 |
| 言語 | Java (openjdk 23) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 1,248 bytes |
| コンパイル時間 | 3,768 ms |
| コンパイル使用メモリ | 79,684 KB |
| 実行使用メモリ | 721,128 KB |
| 最終ジャッジ日時 | 2024-07-04 14:00:27 |
| 合計ジャッジ時間 | 24,515 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 28 MLE * 3 |
ソースコード
//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));}
}
t8m8⛄️