結果
| 問題 |
No.1665 quotient replace
|
| コンテスト | |
| ユーザー |
houren
|
| 提出日時 | 2021-12-08 21:01:11 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 934 ms / 3,000 ms |
| コード長 | 839 bytes |
| コンパイル時間 | 1,656 ms |
| コンパイル使用メモリ | 170,412 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-16 09:14:19 |
| 合計ジャッジ時間 | 16,469 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 41 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(x) (x).begin(),(x).end()
int main(){
int MAX_N = 1001;
vector<bool> PNJudge(MAX_N,true);
vector<int> pn;
PNJudge[1] = false;
for(int i=2;i<MAX_N;i++){
if(!PNJudge[i]) continue;
pn.push_back(i);
for(int j=i*2;j<MAX_N;j+=i) PNJudge[j] = false;
}
int n;
cin >> n;
int nim = 0;
rep(i,n){
int a;
cin >> a;
int cnt = 0;
for(int x:pn){
if(a==1) break;
while(!(a%x)){
a /= x;
cnt++;
}
}
if(a!=1) cnt++;
nim ^= cnt;
}
if(nim) cout << "white" << endl;
else cout << "black" << endl;
return 0;
}
houren