結果
問題 | No.153 石の山 |
ユーザー |
|
提出日時 | 2024-09-20 23:27:53 |
言語 | Scheme (Gauche-0.9.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 859 bytes |
コンパイル時間 | 102 ms |
コンパイル使用メモリ | 5,120 KB |
実行使用メモリ | 16,640 KB |
最終ジャッジ日時 | 2024-09-20 23:27:56 |
合計ジャッジ時間 | 2,478 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 RE * 2 |
other | AC * 2 RE * 25 |
ソースコード
(define (f n)(let((grundy (make-vector 101 0)))(vector-set! grundy 2 1)(do((i 3 (+ i 1)))((> i n))(let*((a (bitwise-xor (vector-ref grundy (quotient i 3)) (vector-ref grundy (+ (quotient i 3) (if (> (remainder i 3) 0) 1 0))) (vector-ref grundy(+ (quotient i 3) (if (> (remainder i 3) 1) 1 0))))))((b (bitwise-xor (vector-ref grundy (quotient i 2)) (vector-ref grundy (+ (quotient i 2) (if (= (remainder i 2) 1) 1 0))))))(let loop ()(when (or (= (vector-ref grundy i) a) (= (vector-ref grundy i) b))(vector-set! grundy i (+ 1 (vector-ref grundy i)))(loop)))))grundy))(define yuki153(let* ((n (read)) (grundy (f n)))(if (= n 1)(display "B\n")(if (zero? (vector-ref grundy n))(display "B\n")(display "A\n")))))