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