結果

問題 No.428 小数から逃げる夢
ユーザー neko_the_shadow
提出日時 2016-10-02 23:29:30
言語 Scheme
(Gauche-0.9.15)
結果
AC  
実行時間 28 ms / 1,000 ms
コード長 504 bytes
コンパイル時間 83 ms
コンパイル使用メモリ 5,376 KB
実行使用メモリ 16,000 KB
最終ジャッジ日時 2024-11-21 14:42:11
合計ジャッジ時間 5,075 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 100
権限があれば一括ダウンロードができます

ソースコード

diff #

(define D
  (+ 1
     (* (fold (lambda (i sum) (+ (* sum 100) i))
              123456789
              (iota 90 10))
        10)))

(define N (read))

(define (MAIN)
  (let ((x (quotient (* N D) (expt 10 190)))
        (s (number->string (* N D))))

    (display
      (cond
        ((zero? x) (format "0.~A" s))
        ((< x 10)  (format "~A.~A" (substring s 0 1) (substring s 1 (string-length s))))
        ((< x 100)  (format "~A.~A" (substring s 0 2) (substring s 2 (string-length s))))))))

(MAIN)
0