結果

問題 No.2 素因数ゲーム
コンテスト
ユーザー yoza
提出日時 2015-02-27 18:17:41
言語 Nim
(2.2.8)
コンパイル:
nim --nimcache=~ --hints:off -o:a.out -d:release cpp _filename_
実行:
./a.out
結果
AC  
実行時間 1 ms / 5,000 ms
+ 309µs
コード長 487 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,283 ms
コンパイル使用メモリ 69,096 KB
実行使用メモリ 5,888 KB
最終ジャッジ日時 2026-08-01 08:22:23
合計ジャッジ時間 3,983 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 31
権限があれば一括ダウンロードができます
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 18) Warning: imported and not used: 'sequtils' [UnusedImport]
/home/judge/data/code/Main.nim(1, 28) Warning: imported and not used: 'algorithm' [UnusedImport]

ソースコード

diff #
raw source code

import strutils, sequtils, algorithm, math

proc prime_count(n: var int): seq[int] =
  var
    i = 2
    count = 0

  result = newSeq[int](0)
  while i * i <= n:
    count = 0
    while n mod i == 0:
      count += 1
      n = n div i
    if count > 0:
      result.add(count)
    i += 1
  if n > 1:
    result.add(1)
  return

var
  n = readLine(stdin).parseInt()
  k = 0
  winner : string

for c in prime_count(n):
  k = k xor c

winner = if k == 0: "Bob" else: "Alice"


echo(winner)
0