結果

問題 No.2 素因数ゲーム
ユーザー たこしたこし
提出日時 2015-06-06 18:27:43
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 1,233 bytes
コンパイル時間 649 ms
コンパイル使用メモリ 89,044 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-20 19:33:15
合計ジャッジ時間 9,818 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 784 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 3 ms
4,376 KB
testcase_11 AC 3 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 3 ms
4,380 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 2 ms
4,384 KB
testcase_17 AC 40 ms
4,380 KB
testcase_18 AC 1 ms
4,380 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 TLE -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <queue>
#include <complex>

#define INF_MIN 100000000
#define INF 1145141919
#define INF_MAX 2147483647
#define LL_MAX 9223372036854775807
#define EPS 1e-9
#define PI acos(-1)
#define LL long long

using namespace std;

int N;

bool checkPrime(int n){

  for(int i = 2; i*i <= n; i++){
    if(n%i == 0)
      return false;
  }

  return true;

}

int main(){

  cin >> N;

  int ans = 0;

  if(checkPrime(N)){
    cout << "Alice" << endl;
    return 0;
  }

  for(int prime = 2; N > 1; prime++){
    
    int j;
    
    for(j = 2; j*j <= prime; j++){
      if(prime % j == 0)
	break;
    }

    if(j*j<=prime)
      continue;

    int cnt = 0;
    while(N%prime == 0){
      cnt++;
      N /= prime;
    }

    ans ^= cnt;

  }

  if(ans == 0)
    cout << "Bob" << endl;
  else
    cout << "Alice" << endl;

  return 0;

}
0