結果
| 問題 |
No.103 素因数ゲーム リターンズ
|
| コンテスト | |
| ユーザー |
bal4u
|
| 提出日時 | 2019-07-22 10:27:50 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 5,000 ms |
| コード長 | 628 bytes |
| コンパイル時間 | 381 ms |
| コンパイル使用メモリ | 31,488 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-23 18:33:53 |
| 合計ジャッジ時間 | 1,090 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 20 |
コンパイルメッセージ
main.c: In function 'in':
main.c:8:14: warning: implicit declaration of function 'getchar_unlocked' [-Wimplicit-function-declaration]
8 | #define gc() getchar_unlocked()
| ^~~~~~~~~~~~~~~~
main.c:14:24: note: in expansion of macro 'gc'
14 | int n = 0, c = gc();
| ^~
ソースコード
// yukicoder: No.103 素因数ゲーム リターンズ
// 2019.7.22 bal4u
#include <stdio.h>
#include <math.h>
#if 1
#define gc() getchar_unlocked()
#else
#define gc() getchar()
#endif
int in() { // 非負整数の入力
int n = 0, c = gc();
do n = 10 * n + (c & 0xf); while ((c = gc()) >= '0');
return n;
}
int main()
{
int i, N, m, b, p, ans;
ans = 0;
N = in(); while (N--) {
m = in(), b = (int)sqrt((double)m);
for (i = 2; m >= i && i <= b; i++) {
if (m % i == 0) {
p = 0; while (m % i == 0) m /= i, p++;
ans ^= p % 3;
}
}
if (m > 1) ans ^= 1;
}
puts(ans ? "Alice" : "Bob");
return 0;
}
bal4u