結果

問題 No.2 素因数ゲーム
ユーザー face4
提出日時 2018-09-06 15:39:32
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 5,000 ms
コード長 454 bytes
コンパイル時間 719 ms
コンパイル使用メモリ 63,488 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-26 13:34:16
合計ジャッジ時間 1,747 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
using namespace std;

int main(){
    int n;
    cin >> n;

    int ans = 0;
    for(int i = 2; i*i <= n; i++){
        if(n%i == 0){
            int tmp = 0;
            while(n%i == 0){
                tmp++;
                n /= i;
            }
            ans ^= tmp;
        }
    }
    if(n != 1)  ans ^= 1;
    
    if(ans == 0){
        cout << "Bob" << endl;
    }else{
        cout << "Alice" << endl;
    }

    return 0;
}
0