結果
| 問題 | No.2 素因数ゲーム |
| コンテスト | |
| ユーザー |
assy1028
|
| 提出日時 | 2015-03-20 18:39:03 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 934 bytes |
| コンパイル時間 | 1,580 ms |
| コンパイル使用メモリ | 85,620 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-26 11:04:18 |
| 合計ジャッジ時間 | 2,176 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 31 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:49:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
49 | scanf("%d", &n);
| ~~~~~^~~~~~~~~~
ソースコード
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <complex>
#include <string.h>
using namespace std;
#define endl '\n'
#define all(v) (v).begin(), (v).end()
#define uniq(v) (v).erase(unique((v).begin(), (v).end()), (v).end())
typedef long long ll;
typedef pair<int, int> P;
typedef unsigned int uint;
const int inf = 1000000009;
map<int, int> prime_factor(int n) {
map<int, int> res;
for (int i = 2; i * i <= n; i++) {
while (n % i == 0) {
res[i]++;
n /= i;
}
}
if (n != 1) res[n] = 1;
return res;
}
bool solve(int n) {
map<int, int> pf = prime_factor(n);
int x = 0;
for (auto& kv : pf) {
x ^= kv.second;
}
return x != 0;
}
int main() {
int n;
scanf("%d", &n);
printf("%s\n", solve(n) ? "Alice" : "Bob");
}
assy1028