結果

問題 No.2 素因数ゲーム
ユーザー Nasatame
提出日時 2017-01-13 15:51:37
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 322 ms / 5,000 ms
コード長 699 bytes
コンパイル時間 783 ms
コンパイル使用メモリ 62,312 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-26 12:53:59
合計ジャッジ時間 2,670 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
int main(void){
    // Here your code !
    int N;
    cin >> N;
    
    vector<int> a;
    
    while(N != 1){
        int tmp = 0;
        for(int i = 2; i <= N; i++){
            if(N%i == 0){
                tmp = i;
                break;
            }
        }
        
        int res = 0;
        while( N % tmp == 0){
            res++;
            N /= tmp;
        }
        a.push_back(res);
    
    }
    
    int ans = 0;
    for(int i = 0; i < a.size(); i++){
        ans = ans xor a[i];
    }
    
    if(ans){
        cout << "Alice" << endl;
    }else{
        cout << "Bob" << endl;
    }
    
}
0