結果
問題 | No.2 素因数ゲーム |
ユーザー |
![]() |
提出日時 | 2014-11-26 20:59:07 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 856 bytes |
コンパイル時間 | 1,594 ms |
コンパイル使用メモリ | 153,756 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2025-01-03 09:07:04 |
合計ジャッジ時間 | 2,466 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 27 WA * 4 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:27:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 27 | scanf("%d", &N); | ~~~~~^~~~~~~~~~
ソースコード
#include <bits/stdc++.h> using namespace std; const int LIMIT = 100000; bool isprime[LIMIT+1]; int prime[LIMIT+1]; int lim; void eratosthenes(void){ fill(isprime, isprime+LIMIT+1, true); lim = 0; for(int x = 2; x * x <= LIMIT; x++){ if(isprime[x]){ prime[lim++] = x; for(int y = x * x; y <= 10000; y += x){ isprime[y] = false; } } } } int N; int main(){ eratosthenes(); scanf("%d", &N); int ret = 0; for(int x = 0; N > 1 && x < lim; x++){ int cnt = 0; while(N % prime[x] == 0){ cnt++; N /= prime[x]; } ret ^= cnt; } if(N > 1){ ret ^= 1; } if(ret){ puts("Alice"); }else{ puts("Bob"); } return 0; }