結果
| 問題 | No.2 素因数ゲーム |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-07-06 11:24:42 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 20 ms / 5,000 ms |
| コード長 | 367 bytes |
| コンパイル時間 | 2,331 ms |
| コンパイル使用メモリ | 200,860 KB |
| 最終ジャッジ日時 | 2025-01-30 05:00:02 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 31 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:7:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
7 | scanf("%d", &N);
| ~~~~~^~~~~~~~~~
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(void) {
int N;
scanf("%d", &N);
map<int,int> pf;
for (int i = 2; i <= sqrt(N); ++i) {
if (N % i) continue;
while (N % i == 0) {
++pf[i];
N /= i;
}
}
if (N != 1) ++pf[N];
int x = 0;
for (auto [a, b] : pf) x ^= b;
printf("%s\n", x ? "Alice" : "Bob");
return 0;
}