結果

問題 No.185 和風
ユーザー noelexnoelex
提出日時 2017-11-03 17:29:25
言語 F#
(F# 4.0)
結果
AC  
実行時間 88 ms / 1,000 ms
コード長 602 bytes
コンパイル時間 3,903 ms
コンパイル使用メモリ 159,936 KB
実行使用メモリ 24,980 KB
最終ジャッジ日時 2023-08-14 16:37:15
合計ジャッジ時間 5,228 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 86 ms
23,048 KB
testcase_01 AC 88 ms
22,888 KB
testcase_02 AC 86 ms
23,000 KB
testcase_03 AC 87 ms
24,980 KB
testcase_04 AC 87 ms
22,960 KB
testcase_05 AC 84 ms
22,932 KB
testcase_06 AC 86 ms
22,872 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) F# Compiler version 11.0.0.0 for F# 5.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

ソースコード

diff #

open System

[<EntryPoint>]
let main argv = 
    let rec readLines n=function
        | lst when n=0 -> lst
        | lst -> 
            let line = Console.ReadLine().Split(' ') 
            (Seq.head line |> int, Seq.last line |> int) :: lst |> readLines (n-1)

    let rec solve n lst=
        match lst, n with
        | (x,y)::tail, None -> solve (Some (y-x)) tail
        | (x,y)::tail, Some n -> if n=y-x then solve (Some n) tail else -1
        | [], Some n when n > 0 -> n
        | _, _ -> -1

    let N = Console.ReadLine () |> int
    [] |> (readLines N) |> solve None |> printfn "%d"
    0
0