結果

問題 No.103 素因数ゲーム リターンズ
ユーザー 6soukiti296soukiti29
提出日時 2017-08-23 03:41:40
言語 Nim
(2.0.2)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 717 bytes
コンパイル時間 3,000 ms
コンパイル使用メモリ 69,304 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-12 14:58:11
合計ジャッジ時間 3,977 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

import sequtils,strutils

var
    n = stdin.readline.parseInt
    M = stdin.readline.split.map(parseInt)
    sosu = newSeq[int](0)
    N : array[2..(1e4).int, bool]
    f : int

for i in 2..<(1e4).int:
    if N[i] == false:
        sosu.add(i)
        var j = i
        while j < 1e4.int:
            N[j] = true
            j += i
for m in M:
    var
        p = m
        cnt = 0
        i = 0
    while true:
        if p mod sosu[i] == 0:
            p = p div sosu[i]
            cnt += 1
        elif cnt > 0:
            f = (f xor (cnt mod 3))
            cnt = 0
            i += 1
            if p == 1:
                break
        else:
            i += 1
if f == 0:
    echo "Bob"
else:
    echo "Alice"
0