結果

問題 No.428 小数から逃げる夢
ユーザー nobigomunobigomu
提出日時 2018-06-07 12:45:29
言語 F#
(F# 4.0)
結果
AC  
実行時間 169 ms / 1,000 ms
コード長 1,278 bytes
コンパイル時間 4,365 ms
コンパイル使用メモリ 160,824 KB
実行使用メモリ 31,292 KB
最終ジャッジ日時 2023-09-12 23:00:09
合計ジャッジ時間 24,385 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 146 ms
22,896 KB
testcase_01 AC 146 ms
22,816 KB
testcase_02 AC 149 ms
24,996 KB
testcase_03 AC 146 ms
24,984 KB
testcase_04 AC 146 ms
25,040 KB
testcase_05 AC 147 ms
25,000 KB
testcase_06 AC 147 ms
24,932 KB
testcase_07 AC 146 ms
24,860 KB
testcase_08 AC 147 ms
25,008 KB
testcase_09 AC 165 ms
29,240 KB
testcase_10 AC 164 ms
27,212 KB
testcase_11 AC 165 ms
27,120 KB
testcase_12 AC 167 ms
29,172 KB
testcase_13 AC 163 ms
25,016 KB
testcase_14 AC 165 ms
27,124 KB
testcase_15 AC 168 ms
29,140 KB
testcase_16 AC 167 ms
27,068 KB
testcase_17 AC 165 ms
27,112 KB
testcase_18 AC 165 ms
27,132 KB
testcase_19 AC 165 ms
29,188 KB
testcase_20 AC 165 ms
27,132 KB
testcase_21 AC 164 ms
29,256 KB
testcase_22 AC 164 ms
27,136 KB
testcase_23 AC 167 ms
27,188 KB
testcase_24 AC 165 ms
27,312 KB
testcase_25 AC 165 ms
27,200 KB
testcase_26 AC 164 ms
27,204 KB
testcase_27 AC 165 ms
27,196 KB
testcase_28 AC 166 ms
31,292 KB
testcase_29 AC 165 ms
27,248 KB
testcase_30 AC 165 ms
25,012 KB
testcase_31 AC 165 ms
27,192 KB
testcase_32 AC 165 ms
29,172 KB
testcase_33 AC 167 ms
27,060 KB
testcase_34 AC 165 ms
29,252 KB
testcase_35 AC 164 ms
27,128 KB
testcase_36 AC 164 ms
27,324 KB
testcase_37 AC 164 ms
27,128 KB
testcase_38 AC 164 ms
27,200 KB
testcase_39 AC 167 ms
29,252 KB
testcase_40 AC 166 ms
29,124 KB
testcase_41 AC 164 ms
29,132 KB
testcase_42 AC 165 ms
29,140 KB
testcase_43 AC 166 ms
29,176 KB
testcase_44 AC 165 ms
29,252 KB
testcase_45 AC 166 ms
27,208 KB
testcase_46 AC 164 ms
29,204 KB
testcase_47 AC 165 ms
25,060 KB
testcase_48 AC 165 ms
27,124 KB
testcase_49 AC 165 ms
29,252 KB
testcase_50 AC 165 ms
29,320 KB
testcase_51 AC 163 ms
25,156 KB
testcase_52 AC 165 ms
27,184 KB
testcase_53 AC 164 ms
27,180 KB
testcase_54 AC 164 ms
29,260 KB
testcase_55 AC 163 ms
25,092 KB
testcase_56 AC 165 ms
29,308 KB
testcase_57 AC 165 ms
29,300 KB
testcase_58 AC 166 ms
25,080 KB
testcase_59 AC 166 ms
27,188 KB
testcase_60 AC 166 ms
29,256 KB
testcase_61 AC 166 ms
29,212 KB
testcase_62 AC 165 ms
27,200 KB
testcase_63 AC 164 ms
25,156 KB
testcase_64 AC 165 ms
27,112 KB
testcase_65 AC 166 ms
29,264 KB
testcase_66 AC 166 ms
27,088 KB
testcase_67 AC 165 ms
29,176 KB
testcase_68 AC 165 ms
29,300 KB
testcase_69 AC 165 ms
27,068 KB
testcase_70 AC 165 ms
29,180 KB
testcase_71 AC 164 ms
29,144 KB
testcase_72 AC 166 ms
27,192 KB
testcase_73 AC 166 ms
29,240 KB
testcase_74 AC 166 ms
29,188 KB
testcase_75 AC 165 ms
27,244 KB
testcase_76 AC 164 ms
27,160 KB
testcase_77 AC 164 ms
27,192 KB
testcase_78 AC 165 ms
27,152 KB
testcase_79 AC 165 ms
29,352 KB
testcase_80 AC 164 ms
27,228 KB
testcase_81 AC 166 ms
29,368 KB
testcase_82 AC 165 ms
25,060 KB
testcase_83 AC 167 ms
29,256 KB
testcase_84 AC 165 ms
29,172 KB
testcase_85 AC 165 ms
29,260 KB
testcase_86 AC 168 ms
27,164 KB
testcase_87 AC 169 ms
29,312 KB
testcase_88 AC 165 ms
27,088 KB
testcase_89 AC 165 ms
29,188 KB
testcase_90 AC 164 ms
29,192 KB
testcase_91 AC 166 ms
25,108 KB
testcase_92 AC 164 ms
25,152 KB
testcase_93 AC 165 ms
29,124 KB
testcase_94 AC 165 ms
29,184 KB
testcase_95 AC 164 ms
29,156 KB
testcase_96 AC 165 ms
29,244 KB
testcase_97 AC 166 ms
27,128 KB
testcase_98 AC 164 ms
27,160 KB
testcase_99 AC 74 ms
22,748 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) F# Compiler version 11.0.0.0 for F# 5.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

ソースコード

diff #

let D = "1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991"
let f n = seq { for i in D.Length-1..-1..0 -> n * int D.[i..i] }
let g m n = Seq.zip (seq { yield 0; yield! f m; yield 0; })
                    (seq { yield! f n; yield 0; yield 0; })
let rec iter i c sq =
    let e = c + Seq.head sq
    seq { yield e%10
          if i>0 then
              yield! iter (i-1) (e/10) (Seq.skip 1 sq)
          else
              if c<>0 && e/10<>0 then yield e/10 }
let rec iter2 i c sq =
    let (e1,e2) = Seq.head sq
    seq { yield (e1+e2+c)%10
          if i>0 then
              yield! iter2 (i-1) ((e1+e2+c)/10) (Seq.skip 1 sq)
          else
              if c<>0 && (e1+e2+c)/10<>0 then yield (e1+e2+c)/10 }
let fmt = Seq.map string >> Seq.fold (fun a e -> e + a) "" >> fun (s:string) ->
    if s.Length<>D.Length then
        s.[0..s.Length-D.Length-1] + "." + s.[s.Length-D.Length..s.Length-1]
    else
        "0." + s

let s = stdin.ReadLine()
match s.Length with
| 1 -> iter (D.Length-1) 0 (f (int s)) |> fmt
| 2 -> iter2 D.Length 0 (g (int s.[0..0]) (int s.[1..1])) |> fmt
| _ -> D.[0..1] + "." + D.[2..D.Length-1]
|> printfn "%s"
0