結果

問題 No.3 ビットすごろく
ユーザー Rin
提出日時 2015-09-03 17:06:49
言語 Scheme
(Gauche-0.9.15)
結果
WA  
実行時間 -
コード長 637 bytes
コンパイル時間 102 ms
コンパイル使用メモリ 6,944 KB
実行使用メモリ 20,864 KB
最終ジャッジ日時 2024-07-18 21:54:50
合計ジャッジ時間 2,928 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 18 WA * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

(define (System.out.println x)
  (begin
    (display x)
    (newline)
  )
)

(define (CntBin1 foo)
  (if (<= foo 2)
      1
      (if (= (modulo foo 2) 0)
          (CntBin1 (/ foo 2))
          (+ 1 (CntBin1 (/ (- foo 1) 2)))
      )
  )
)

(let (
      (N (read))
     )
  (let loop(
            (i 1)
            (Grid 1)
           )
    (if (= Grid N)
        (System.out.println i)
        (if (<= (+ Grid (CntBin1 Grid)) N)
            (loop (+ i 1) (+ Grid (CntBin1 Grid)))
            (if (>= i N)
                (System.out.println -1)
                (loop (+ i 1) (- Grid (CntBin1 Grid)))
            )
        )
    )
  )
)
0