結果

問題 No.2 素因数ゲーム
ユーザー ReERishunReERishun
提出日時 2020-05-08 03:11:42
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 576 bytes
コンパイル時間 209 ms
コンパイル使用メモリ 28,568 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-16 08:17:15
合計ジャッジ時間 3,589 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<stdio.h>

int main() {
	int ans = 0;
	int num = 0;
	int array[30000000];

	// 入力
	scanf("%d", &num);

	// 2で割れるか
	if (!num % 2)
		ans++;
	
	// 素数探索ループ
	for (int i = 3; i < num; i += 2) {
		if (num%i == 0) {
			if (ans > 1) {
				for (int j = 0;; j++) {
					if (ans%array[j] == 0) {
						break;
					}
					else if (j == ans - 2) {
						array[ans] = i;
						ans++;
						break;
					}
				}
			}
			else {
				array[ans] = i;
				ans++;
			}
		}
	}

	// 回答出力
	if (ans % 2)
		printf("Alice");
	else
		printf("Bob");

	return 0;
}
0