結果

問題 No.657 テトラナッチ数列 Easy
ユーザー taktak
提出日時 2018-03-18 01:47:00
言語 F#
(F# 4.0)
結果
AC  
実行時間 395 ms / 2,000 ms
コード長 359 bytes
コンパイル時間 4,611 ms
コンパイル使用メモリ 159,888 KB
実行使用メモリ 46,756 KB
最終ジャッジ日時 2023-08-25 19:13:53
合計ジャッジ時間 11,733 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 336 ms
42,776 KB
testcase_01 AC 340 ms
44,588 KB
testcase_02 AC 341 ms
42,600 KB
testcase_03 AC 335 ms
42,596 KB
testcase_04 AC 340 ms
44,684 KB
testcase_05 AC 386 ms
44,704 KB
testcase_06 AC 335 ms
42,644 KB
testcase_07 AC 339 ms
42,800 KB
testcase_08 AC 341 ms
44,716 KB
testcase_09 AC 389 ms
42,744 KB
testcase_10 AC 393 ms
44,784 KB
testcase_11 AC 392 ms
46,756 KB
testcase_12 AC 392 ms
44,756 KB
testcase_13 AC 387 ms
42,684 KB
testcase_14 AC 395 ms
42,664 KB
testcase_15 AC 390 ms
44,796 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) F# Compiler version 11.0.0.0 for F# 5.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

ソースコード

diff #

open System

let read() = Console.ReadLine() |> int

let tetra =
    let rec f a b c d =
        seq{
            yield a
            yield! f b c d ((a+b+c+d)%17)
        }
    f 0 0 0 1
    |> Seq.cache
    |> Seq.take(1000000+5)
    |> Seq.toArray

let Q = read()
let n = Array.init Q (fun _ -> read())

n
|> Array.iter(fun x -> printfn "%i" tetra.[x-1])

0