結果
| 問題 |
No.2 素因数ゲーム
|
| コンテスト | |
| ユーザー |
t8m8⛄️
|
| 提出日時 | 2015-04-12 17:02:07 |
| 言語 | Java (openjdk 23) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,292 bytes |
| コンパイル時間 | 4,052 ms |
| コンパイル使用メモリ | 79,384 KB |
| 実行使用メモリ | 263,968 KB |
| 最終ジャッジ日時 | 2024-07-04 13:57:55 |
| 合計ジャッジ時間 | 14,750 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 19 TLE * 1 -- * 11 |
ソースコード
//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));}
}
t8m8⛄️