結果

問題 No.3 ビットすごろく
ユーザー RinRin
提出日時 2015-09-03 17:06:49
言語 Scheme
(Gauche-0.9.14)
結果
WA  
実行時間 -
コード長 637 bytes
コンパイル時間 279 ms
コンパイル使用メモリ 5,284 KB
実行使用メモリ 15,552 KB
最終ジャッジ日時 2023-09-26 02:35:46
合計ジャッジ時間 3,967 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
11,688 KB
testcase_01 AC 18 ms
11,696 KB
testcase_02 AC 18 ms
11,804 KB
testcase_03 AC 27 ms
13,420 KB
testcase_04 AC 18 ms
11,932 KB
testcase_05 AC 45 ms
14,040 KB
testcase_06 AC 28 ms
13,620 KB
testcase_07 AC 19 ms
12,012 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 43 ms
13,800 KB
testcase_13 AC 25 ms
12,996 KB
testcase_14 AC 64 ms
15,456 KB
testcase_15 AC 73 ms
15,400 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 20 ms
12,096 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 19 ms
11,676 KB
testcase_22 AC 65 ms
15,512 KB
testcase_23 AC 72 ms
15,344 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 18 ms
11,776 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 17 ms
11,776 KB
testcase_32 WA -
権限があれば一括ダウンロードができます

ソースコード

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