結果
| 問題 |
No.2 素因数ゲーム
|
| コンテスト | |
| ユーザー |
佐藤淳平
|
| 提出日時 | 2019-09-06 11:53:38 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 428 bytes |
| コンパイル時間 | 1,692 ms |
| コンパイル使用メモリ | 158,780 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-06-23 18:26:52 |
| 合計ジャッジ時間 | 2,284 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 31 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:6:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
6 | scanf("%d", &n);
| ~~~~~^~~~~~~~~~
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
scanf("%d", &n);
int ans = 0;
for (int i = 2; i * i <= n ; i++) {
if (n % i == 0){
int counter = 0;
while (n % i == 0) {
n /= i;
counter++;
}
ans ^= counter;
}
}
if (n > 1) ans ^= 1;
if (ans) printf("Alice");
else printf("Bob");
}
佐藤淳平