結果
問題 |
No.2 素因数ゲーム
|
ユーザー |
![]() |
提出日時 | 2015-06-10 21:14:53 |
言語 | C90 (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 5,000 ms |
コード長 | 560 bytes |
コンパイル時間 | 1,095 ms |
コンパイル使用メモリ | 20,864 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-26 11:19:36 |
合計ジャッジ時間 | 2,228 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 31 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:5:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 5 | scanf("%d", &N); | ^~~~~~~~~~~~~~~
ソースコード
#include <stdio.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; for (i=3; i*i<=N; 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; }