結果

問題 No.2 素因数ゲーム
ユーザー J31831276J31831276
提出日時 2018-12-30 03:18:51
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2,818 ms / 5,000 ms
コード長 815 bytes
コンパイル時間 576 ms
コンパイル使用メモリ 63,808 KB
実行使用メモリ 418,252 KB
最終ジャッジ日時 2023-08-27 05:04:30
合計ジャッジ時間 85,408 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2,577 ms
418,164 KB
testcase_01 AC 2,563 ms
417,968 KB
testcase_02 AC 2,533 ms
418,100 KB
testcase_03 AC 2,538 ms
418,104 KB
testcase_04 AC 2,528 ms
417,980 KB
testcase_05 AC 2,523 ms
418,152 KB
testcase_06 AC 2,534 ms
418,248 KB
testcase_07 AC 2,542 ms
418,124 KB
testcase_08 AC 2,547 ms
418,044 KB
testcase_09 AC 2,538 ms
417,972 KB
testcase_10 AC 2,543 ms
418,248 KB
testcase_11 AC 2,722 ms
418,012 KB
testcase_12 AC 2,572 ms
418,004 KB
testcase_13 AC 2,560 ms
418,004 KB
testcase_14 AC 2,532 ms
418,040 KB
testcase_15 AC 2,543 ms
417,960 KB
testcase_16 AC 2,534 ms
417,968 KB
testcase_17 AC 2,564 ms
418,240 KB
testcase_18 AC 2,542 ms
417,996 KB
testcase_19 AC 2,546 ms
418,108 KB
testcase_20 AC 2,537 ms
418,016 KB
testcase_21 AC 2,559 ms
417,956 KB
testcase_22 AC 2,540 ms
418,252 KB
testcase_23 AC 2,558 ms
418,060 KB
testcase_24 AC 2,565 ms
418,040 KB
testcase_25 AC 2,520 ms
417,968 KB
testcase_26 AC 2,561 ms
418,036 KB
testcase_27 AC 2,530 ms
418,040 KB
testcase_28 AC 2,518 ms
418,044 KB
testcase_29 AC 2,530 ms
418,248 KB
testcase_30 AC 2,818 ms
417,964 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <cstdio>
#include <string>
#include <cmath>

#define ll long long

using namespace std;

int prime[6000000];
int arr[100000000];
int cnt=0;
void Eratosthenes(int N){

	for(int i = 0; i < N; i++) arr[i] = 1;
	
	for(int i = 2; i < sqrt(N); i++)
		if(arr[i]){
			for(int j = 0; i * (j + 2) < N; j++){
				arr[i *(j + 2)] = 0;
			}
	    }

	for(int i = 2; i < N; i++)
		if(arr[i]) prime[cnt++]=i;
}

int nim[100000000];
int main(){

   int n;
   cin>>n;
   Eratosthenes(100000000);
      
   int t=0;
   while(true){
       while(n%prime[t]==0){
           nim[t]++;
           n/=prime[t];
       }
       t++;
       if(n==1) break;
   }
   
   int ans=0;
   for(int i=0;i<t;++i) ans^=nim[i];
   if(ans) cout<<"Alice"<<endl;
   else cout<<"Bob"<<endl;

   return 0;
}
0