結果

問題 No.1665 quotient replace
ユーザー hourenhouren
提出日時 2021-12-08 21:01:11
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 925 ms / 3,000 ms
コード長 839 bytes
コンパイル時間 2,711 ms
コンパイル使用メモリ 169,248 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-23 09:30:57
合計ジャッジ時間 19,730 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 3 ms
4,376 KB
testcase_04 AC 3 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 9 ms
4,380 KB
testcase_07 AC 3 ms
4,380 KB
testcase_08 AC 5 ms
4,376 KB
testcase_09 AC 29 ms
4,380 KB
testcase_10 AC 313 ms
4,376 KB
testcase_11 AC 698 ms
4,376 KB
testcase_12 AC 77 ms
4,376 KB
testcase_13 AC 922 ms
4,380 KB
testcase_14 AC 922 ms
4,380 KB
testcase_15 AC 923 ms
4,380 KB
testcase_16 AC 925 ms
4,376 KB
testcase_17 AC 923 ms
4,376 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 2 ms
4,380 KB
testcase_25 AC 2 ms
4,380 KB
testcase_26 AC 4 ms
4,380 KB
testcase_27 AC 9 ms
4,376 KB
testcase_28 AC 35 ms
4,376 KB
testcase_29 AC 69 ms
4,376 KB
testcase_30 AC 501 ms
4,376 KB
testcase_31 AC 770 ms
4,376 KB
testcase_32 AC 671 ms
4,380 KB
testcase_33 AC 251 ms
4,376 KB
testcase_34 AC 539 ms
4,376 KB
testcase_35 AC 490 ms
4,376 KB
testcase_36 AC 518 ms
4,380 KB
testcase_37 AC 471 ms
4,380 KB
testcase_38 AC 570 ms
4,376 KB
testcase_39 AC 395 ms
4,376 KB
testcase_40 AC 398 ms
4,376 KB
testcase_41 AC 397 ms
4,380 KB
testcase_42 AC 2 ms
4,380 KB
testcase_43 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0