結果

問題 No.2 素因数ゲーム
コンテスト
ユーザー MiyamonY
提出日時 2019-09-10 15:37:55
言語 Scheme
(Gauche-0.9.15)
コンパイル:
true
実行:
gosh _filename_
結果
AC  
実行時間 84 ms / 5,000 ms
コード長 463 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 266 ms
コンパイル使用メモリ 7,968 KB
実行使用メモリ 29,696 KB
最終ジャッジ日時 2026-03-24 00:14:57
合計ジャッジ時間 3,402 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

(use math.prime)

(define (read-number)
  (string->number (read-line)))

(let* ((n (read-number)))
  (define primes (naive-factorize n))

  (define assoc '())
  (let loop ((primes primes))
    (unless (null? primes)
      (let1 prime (car primes)
	    (set! assoc (assoc-set! assoc prime (+ 1 (assoc-ref assoc prime 0)))))
      (loop (cdr primes))))

  (if (= (fold (lambda (x init) (logxor init (cdr x))) 0 assoc) 0)
      (print "Bob")
      (print "Alice")))
0