結果
問題 |
No.2 素因数ゲーム
|
ユーザー |
|
提出日時 | 2022-03-08 09:46:23 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 593 bytes |
コンパイル時間 | 4,531 ms |
コンパイル使用メモリ | 257,364 KB |
最終ジャッジ日時 | 2025-01-28 07:44:02 |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 31 |
ソースコード
#include<bits/stdc++.h> using namespace std; #include<atcoder/all> using namespace atcoder; using ll = long long; ll n; vector<long long> prime_factor(long long n){ vector<long long> res; for(long long i = 2;i*i <= n;i++){ while(n%i==0){ res.push_back(i); n/=i; } } if(n!=1)res.push_back(n); return res; } void solve(){ auto v = prime_factor(n); map<ll,ll> mp; for(auto &i:v)mp[i]++; ll x = 0; for(auto &[l,r]:mp){ x ^= r; } if(x)cout<<"Alice"<<endl; else cout<<"Bob"<<endl; } signed main(){ cin.tie(nullptr); ios::sync_with_stdio(false); cin >> n; solve(); }