結果

問題 No.2 素因数ゲーム
ユーザー MiyamonY
提出日時 2019-09-10 15:37:55
言語 Scheme
(Gauche-0.9.15)
結果
AC  
実行時間 109 ms / 5,000 ms
コード長 463 bytes
コンパイル時間 62 ms
コンパイル使用メモリ 5,248 KB
実行使用メモリ 29,568 KB
最終ジャッジ日時 2024-07-02 16:16:31
合計ジャッジ時間 4,260 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

(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