結果

問題 No.2 素因数ゲーム
ユーザー imgry22imgry22
提出日時 2014-12-11 18:19:19
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,576 bytes
コンパイル時間 809 ms
コンパイル使用メモリ 74,772 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-02 14:00:16
合計ジャッジ時間 2,307 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<algorithm>
#include<cmath>
#include<complex>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<map>
#include<queue>
#include<stack>
#include<string>
#include<vector>
using namespace std;

typedef long long int ll;
typedef unsigned long long int llu;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;

#define rrep(i, m, n) for(int i=m; i<n;  i++)
#define erep(i, n)    for(int i=1; i<=n; i++)
#define  rep(i, n)    for(int i=0; i<n;  i++)
#define rrev(i, m, n) for(int i=n-1; i>=m; i--)
#define erev(i, n)    for(int i=n; i>=1; i--)
#define  rev(i, n)    for(int i=n-1; i>=0; i--)
#define EACH(v)       (v).begin(), (v).end()
#define CNT(a, n, x)  (upper_bound(a, a+n, x)-lower_bound(a, a+n, x))
#define minup(m, x)   (m=min(m, x))
#define maxup(m, x)   (m=max(m, x))
#define mp             make_pair

#define INF 1000000000
#define MOD 1000000009
#define EPS 1E-9

#define MAX_N 100000000

ll n;
ll prime[MAX_N];
bool isPrime[MAX_N];
int ptr;

int main()
{
  cin >> n;

  for(int i=2; n%i==0; i*=2){
    prime[ptr] += 1;
  }

  if(prime[ptr]) ptr += 1;
  for(int i=3; i<=sqrt(n); i+=2){
    if(!isPrime[i]){
      for(int j=2*i; j<=sqrt(n); j+=i){
        isPrime[j] = true;
      }
      int j;
      for(j=i; n%j==0; j*=i){
        prime[ptr] += 1;
      }
      if(prime[ptr]) ptr += 1;
    }
  }

  int res = 0;

  rep(i, ptr) {
    res ^= prime[i];
  }

  puts(!ptr ? "Alice" :  res ? "Alice" : "Bob");

  return 0;
}
0