結果

問題 No.2 素因数ゲーム
ユーザー J31831276J31831276
提出日時 2018-12-30 03:14:18
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 811 bytes
コンパイル時間 636 ms
コンパイル使用メモリ 62,732 KB
実行使用メモリ 417,400 KB
最終ジャッジ日時 2024-04-15 03:02:10
合計ジャッジ時間 78,589 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3,077 ms
416,464 KB
testcase_01 AC 2,853 ms
416,512 KB
testcase_02 AC 2,585 ms
416,492 KB
testcase_03 AC 2,378 ms
417,096 KB
testcase_04 AC 2,335 ms
416,588 KB
testcase_05 AC 2,307 ms
416,492 KB
testcase_06 AC 2,367 ms
416,480 KB
testcase_07 AC 2,370 ms
416,504 KB
testcase_08 WA -
testcase_09 AC 2,317 ms
416,588 KB
testcase_10 AC 2,328 ms
416,600 KB
testcase_11 AC 2,334 ms
416,572 KB
testcase_12 AC 2,315 ms
416,540 KB
testcase_13 AC 2,315 ms
416,456 KB
testcase_14 AC 2,318 ms
416,708 KB
testcase_15 AC 2,310 ms
416,372 KB
testcase_16 AC 2,333 ms
416,876 KB
testcase_17 AC 2,339 ms
417,096 KB
testcase_18 AC 2,284 ms
416,452 KB
testcase_19 AC 2,317 ms
416,668 KB
testcase_20 WA -
testcase_21 AC 2,348 ms
416,444 KB
testcase_22 AC 2,332 ms
417,400 KB
testcase_23 AC 2,334 ms
416,532 KB
testcase_24 AC 2,311 ms
416,488 KB
testcase_25 AC 2,335 ms
416,540 KB
testcase_26 AC 2,355 ms
416,444 KB
testcase_27 AC 2,316 ms
416,504 KB
testcase_28 AC 2,319 ms
416,448 KB
testcase_29 AC 2,317 ms
417,308 KB
testcase_30 AC 2,304 ms
416,472 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[50000];
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