結果

問題 No.2 素因数ゲーム
ユーザー d2verbd2verb
提出日時 2015-05-06 09:22:40
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 377 ms / 5,000 ms
コード長 1,227 bytes
コンパイル時間 1,985 ms
コンパイル使用メモリ 94,252 KB
実行使用メモリ 101,408 KB
最終ジャッジ日時 2023-08-27 03:49:07
合計ジャッジ時間 13,796 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 371 ms
101,128 KB
testcase_01 AC 372 ms
101,256 KB
testcase_02 AC 350 ms
101,132 KB
testcase_03 AC 363 ms
101,180 KB
testcase_04 AC 359 ms
101,212 KB
testcase_05 AC 374 ms
101,120 KB
testcase_06 AC 363 ms
101,124 KB
testcase_07 AC 365 ms
101,140 KB
testcase_08 AC 369 ms
101,132 KB
testcase_09 AC 358 ms
101,140 KB
testcase_10 AC 363 ms
101,124 KB
testcase_11 AC 368 ms
101,132 KB
testcase_12 AC 356 ms
101,256 KB
testcase_13 AC 360 ms
101,308 KB
testcase_14 AC 358 ms
101,300 KB
testcase_15 AC 357 ms
101,184 KB
testcase_16 AC 365 ms
101,196 KB
testcase_17 AC 364 ms
101,328 KB
testcase_18 AC 367 ms
101,164 KB
testcase_19 AC 349 ms
101,136 KB
testcase_20 AC 352 ms
101,124 KB
testcase_21 AC 367 ms
101,216 KB
testcase_22 AC 358 ms
101,132 KB
testcase_23 AC 369 ms
101,128 KB
testcase_24 AC 369 ms
101,408 KB
testcase_25 AC 377 ms
101,204 KB
testcase_26 AC 376 ms
101,188 KB
testcase_27 AC 365 ms
101,308 KB
testcase_28 AC 369 ms
101,140 KB
testcase_29 AC 375 ms
101,144 KB
testcase_30 AC 376 ms
101,124 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <limits>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <complex>

using namespace std;

#define INF (INT_MAX/3)
#define PI (2*acos(0.0))
#define EPS (1e-8)

typedef long long ll;
typedef unsigned long long ull;

bool isPrime[100000001];
ll N;
vector<int> prime;
map<int, int> mp;

void init(){
    for(int i = 0; i <= 100000000; i++) isPrime[i] = true;

    isPrime[0] = isPrime[1] = false;
    for(int i = 2; i * i <= 100000000; i++){
        if(!isPrime[i]) continue;
        prime.push_back(i);
        for(int j = i * i; j <= 100000000; j += i){
            isPrime[i] = false;
        }
    }
}

int main(){
    ios_base::sync_with_stdio(0);
    init();
    cin >> N;
    for(auto p : prime){
        while(N % p == 0){
            N /= p;
            mp[p]++;
        }
    }
    if(N != 1) mp[N]++;

    int ans = 0;
    for(auto m : mp){
        ans ^= m.second;
    }
    if(ans == 0) cout << "Bob" << endl;
    else cout << "Alice" << endl;
    return 0;
}
0