結果

問題 No.478 一般門松列列
ユーザー ichibanshiboriichibanshibori
提出日時 2017-01-27 23:21:02
言語 F#
(F# 4.0)
結果
AC  
実行時間 91 ms / 2,000 ms
コード長 737 bytes
コンパイル時間 5,296 ms
コンパイル使用メモリ 161,584 KB
実行使用メモリ 25,788 KB
最終ジャッジ日時 2023-08-25 10:32:32
合計ジャッジ時間 10,200 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
22,804 KB
testcase_01 AC 82 ms
22,732 KB
testcase_02 AC 82 ms
22,824 KB
testcase_03 AC 83 ms
22,668 KB
testcase_04 AC 84 ms
22,816 KB
testcase_05 AC 83 ms
24,772 KB
testcase_06 AC 84 ms
22,736 KB
testcase_07 AC 84 ms
24,860 KB
testcase_08 AC 83 ms
22,736 KB
testcase_09 AC 83 ms
22,916 KB
testcase_10 AC 82 ms
22,776 KB
testcase_11 AC 89 ms
23,788 KB
testcase_12 AC 87 ms
23,624 KB
testcase_13 AC 89 ms
25,788 KB
testcase_14 AC 90 ms
23,900 KB
testcase_15 AC 91 ms
25,740 KB
testcase_16 AC 86 ms
23,100 KB
testcase_17 AC 89 ms
23,704 KB
testcase_18 AC 87 ms
23,312 KB
testcase_19 AC 90 ms
25,700 KB
testcase_20 AC 88 ms
25,652 KB
testcase_21 AC 88 ms
23,452 KB
testcase_22 AC 86 ms
25,292 KB
testcase_23 AC 85 ms
23,240 KB
testcase_24 AC 85 ms
23,372 KB
testcase_25 AC 87 ms
23,496 KB
testcase_26 AC 84 ms
22,952 KB
testcase_27 AC 84 ms
22,912 KB
testcase_28 AC 84 ms
22,788 KB
testcase_29 AC 83 ms
22,904 KB
testcase_30 AC 87 ms
23,268 KB
testcase_31 AC 85 ms
25,104 KB
testcase_32 AC 84 ms
22,888 KB
testcase_33 AC 85 ms
25,200 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) F# Compiler version 11.0.0.0 for F# 5.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

ソースコード

diff #

let gen_kadomatsu a1 a2 =
    if a1 > a2 then a1 + 1
    elif a1 < a2 then a2 - 1
    else failwith "gen_kadomatsu"

let gen_kadomatsu_retu_retu n k =
    let rec gen_kadomatsu_retu_retu' idx a1 a2 result =
        if idx + 2 >= n then a2 :: a1 :: result
        else
            let a3 =
                if idx + 2 + k >= n then a2
                                    else gen_kadomatsu a1 a2
            gen_kadomatsu_retu_retu' (idx + 1) a2 a3 (a1 :: result)
    in
    gen_kadomatsu_retu_retu' 0 1 0 []


let () =
    let n, k = stdin.ReadLine().Split()
               |> Array.map int
               |> fun arr -> (arr.[0], arr.[1])

    gen_kadomatsu_retu_retu n k
    |> fun lst -> System.String.Join(" ", lst)
    |> printfn "%s"
0