結果
問題 |
No.2 素因数ゲーム
|
ユーザー |
![]() |
提出日時 | 2015-04-12 17:17:06 |
言語 | Java (openjdk 23) |
結果 |
MLE
|
実行時間 | - |
コード長 | 1,221 bytes |
コンパイル時間 | 3,828 ms |
コンパイル使用メモリ | 80,072 KB |
実行使用メモリ | 519,840 KB |
最終ジャッジ日時 | 2024-07-04 14:01:07 |
合計ジャッジ時間 | 17,035 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 29 MLE * 2 |
ソースコード
//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; } out.println(ans!=0?"Alice":"Bob"); } static ArrayList<Integer> primeDecomposition(int n) { ArrayList<Integer> res = new ArrayList<>(); if (n == 1) res.add(1); else { for (int i=2; i<=n; i++) { int cnt = 0; while (n%i == 0) { cnt++; n /= i; } res.add(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));} }