結果
| 問題 |
No.103 素因数ゲーム リターンズ
|
| コンテスト | |
| ユーザー |
logx
|
| 提出日時 | 2020-09-22 12:51:50 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 1,646 bytes |
| コンパイル時間 | 1,831 ms |
| コンパイル使用メモリ | 193,228 KB |
| 最終ジャッジ日時 | 2025-01-14 19:32:21 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 20 |
ソースコード
#include <bits/stdc++.h>
#ifndef ONLINE_JUDGE
#define _GLIBCXX_DEBUG
#endif
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define Clear(a) a = decltype(a)()
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define vec vector
typedef long long ll;
typedef pair<ll,ll> P;
//const ll big=998244353;
const ll big=1000000007LL;
const ll INF=1e18;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
ll max(ll x,ll y){
if(x>y)return x;
else return y;
}
ll min(ll x,ll y){
if(x<y)return x;
else return y;
}
ll expm(ll x,ll y){
if(y==0)return 1;//0^0=1
if(x==1||x==0)return x;
if(y%2==1)return (expm(x,y-1)*x)%big;
ll t=expm(x,y/2);
return (t*t)%big;
}
ll exp(ll x,ll y){
if(y==0)return 1;//0^0=1
if(x==1||y==0)return x;
if(y%2==1)return exp(x,y-1)*x;
ll t=exp(x,y/2);
return t*t;
}
int main(){
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
cout << fixed << setprecision(10);
/*--------------------------------*/
int n;cin >> n;
int ans=0;
rep(i,n){
int m;cin >> m;
int res=0;
for(int i=2;i*i<=m;i++){
if(m%i==0){
int cnt=0;
while(m%i==0){
cnt++;
m/=i;
}
res^=(cnt%3);
}
}
if(m!=1)res^=1;
ans^=res;
}
cout << (ans!=0 ? "Alice":"Bob") << endl;
}
/*
n個の不偏ゲームをさらにMiの素因数の個数の種類個やってるのと同じ
0:0
1:1
2:2
3:0
*/
logx