結果
| 問題 |
No.2 素因数ゲーム
|
| コンテスト | |
| ユーザー |
Irmystp
|
| 提出日時 | 2014-11-26 20:51:41 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 812 bytes |
| コンパイル時間 | 1,605 ms |
| コンパイル使用メモリ | 153,976 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2025-01-03 09:06:47 |
| 合計ジャッジ時間 | 2,522 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 24 WA * 7 |
コンパイルメッセージ
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(N > 1){
ret ^= 1;
}
if(ret){
puts("Alice");
}else{
puts("Bob");
}
return 0;
}
Irmystp