結果
問題 | No.2 素因数ゲーム |
ユーザー |
![]() |
提出日時 | 2020-06-17 22:35:52 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 713 bytes |
コンパイル時間 | 1,560 ms |
コンパイル使用メモリ | 175,584 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-03 12:29:46 |
合計ジャッジ時間 | 2,548 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 31 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll,ll> P; ll N; ll p[10005]; ll j; map<ll,ll> prime_factor(ll n){ map<ll,ll> res; for(ll i=2;i*i<=n;i++){ bool w=true; while(n%i==0){ res[i]++; n=n/i; if(w){ w=false; p[j]=i; j++; } } } if(n!=1){ res[n]=1; p[j]=n; j++; } return res; } int main(void){ cin>>N; map<ll,ll> m; m=prime_factor(N); ll x=0; for(int i=0;i<j;i++){ ll k=m[p[i]]; x^=k; } if(x!=0){ cout<<"Alice"<<endl; }else{ cout<<"Bob"<<endl; } }