結果

問題 No.3 ビットすごろく
ユーザー MiyamonY
提出日時 2019-09-04 00:58:17
言語 Scheme
(Gauche-0.9.15)
結果
WA  
実行時間 -
コード長 365 bytes
コンパイル時間 290 ms
コンパイル使用メモリ 5,504 KB
実行使用メモリ 16,256 KB
最終ジャッジ日時 2024-12-25 16:26:23
合計ジャッジ時間 2,232 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 18 WA * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

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

(let ((n (read-number)))
  (define vec (make-vector (+ n 1) -1))

  (let loop ((i 1)
	     (count 1))
    (cond ((and (<= 1 i) (<= i n) (= (vector-ref vec i) -1))
	   (vector-set! vec i count)
	   (loop (+ i (logcount i)) (+ count 1))
	   (loop (- i (logcount i)) (+ count 1)))))
  (print (vector-ref vec n)))
0