結果

問題 No.2 素因数ゲーム
コンテスト
ユーザー Luke Li
提出日時 2022-04-03 17:28:57
言語 C(gnu17)
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=gnu17 -Wno-error=implicit-function-declaration -Wno-error=implicit-int -Wno-error=incompatible-pointer-types -Wno-error=int-conversion -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
AC  
実行時間 1,753 ms / 5,000 ms
コード長 588 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 222 ms
コンパイル使用メモリ 38,756 KB
最終ジャッジ日時 2026-02-22 09:01:40
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include<stdio.h>
#include <stdbool.h>

bool mark[100000001];
int prime[100000001];
int primeSize;
void init()//sieve of Eratosthenes
{
	primeSize=0;
	for(int i = 2;i <= 100000000; i++)
	{
		if(mark[i] == true) continue;
		prime[primeSize++]=i;
		if(i >= 10000) continue;
		for(int j=i*i; j<=100000000; j+=i)
		{
			mark[j]=true;
		}
	}
} 
int main()
{
	init();
	int n, t = 0, s = 0;
	scanf("%d",&n);
	for(int i = 0; prime[i] <= n; i++){
		while(n%prime[i] == 0){
			n /= prime[i];
			t++;
		}
		s ^= t;
		t = 0;
	}
	if(s != 0){
		printf("Alice");
	}else{
		printf("Bob");
	}
	return 0;
}
0