結果
問題 |
No.1665 quotient replace
|
ユーザー |
![]() |
提出日時 | 2021-09-04 15:21:22 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,013 bytes |
コンパイル時間 | 1,022 ms |
コンパイル使用メモリ | 93,540 KB |
実行使用メモリ | 7,680 KB |
最終ジャッジ日時 | 2024-12-18 02:25:14 |
合計ジャッジ時間 | 21,111 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 31 WA * 10 |
ソースコード
/* -*- coding: utf-8 -*- * * 1665.cc: No.1665 quotient replace - yukicoder */ #include<cstdio> #include<cstdlib> #include<cstring> #include<cmath> #include<iostream> #include<string> #include<vector> #include<map> #include<set> #include<stack> #include<list> #include<queue> #include<deque> #include<algorithm> #include<numeric> #include<utility> #include<complex> #include<functional> using namespace std; /* constant */ const int MAX_N = 1000000; const int MAX_A = 1000000; /* typedef */ /* global variables */ int cache[MAX_A + 1]; /* subroutines */ int countdiv(int a) { if (cache[a] > 0) return cache[a]; int c = 0; for (int p = 1; p * p <= a; p++) if (a % p == 0) { int q = a / p; c += (p != q) ? 2 : 1; } return (cache[a] = c); } /* main */ int main() { int n; scanf("%d", &n); int nim = 0; for (int i = 0; i < n; i++) { int ai; scanf("%d", &ai); nim ^= countdiv(ai) - 1; } if (nim) puts("white"); else puts("black"); return 0; }