結果
| 問題 | No.2 素因数ゲーム |
| コンテスト | |
| ユーザー |
mudbdb
|
| 提出日時 | 2015-06-09 20:47:03 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 606 bytes |
| 記録 | |
| コンパイル時間 | 287 ms |
| コンパイル使用メモリ | 24,832 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-26 03:09:15 |
| 合計ジャッジ時間 | 1,303 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 28 WA * 3 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:6:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
6 | scanf("%d", &N);
| ^~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
#include <math.h>
int main()
{
int N;
scanf("%d", &N);
int ans_set = 0;
int ans;
int pow;
for (pow=0; N%2 == 0; pow++) {
N/=2;
}
if (pow != 0) {
ans_set = 1;
ans = pow;
}
int i;
int end = floor(sqrt(N));
for (i=3; i<=end; i+=2) {
for (pow=0; N%i == 0; pow++) {
N/=i;
}
if (pow != 0) {
if (ans_set == 0) {
ans_set = 1;
ans = pow;
} else {
ans ^= pow;
}
}
}
if (N != 1) {
ans ^= 1;
}
if (ans == 0) {
printf("Bob\n");
} else {
printf("Alice\n");
}
return 0;
}
mudbdb