結果

問題 No.904 サメトロ
ユーザー guriceringuricerin
提出日時 2019-12-18 17:02:02
言語 F#
(F# 4.0)
結果
WA  
実行時間 -
コード長 793 bytes
コンパイル時間 3,224 ms
コンパイル使用メモリ 160,696 KB
実行使用メモリ 27,016 KB
最終ジャッジ日時 2023-09-20 19:44:37
合計ジャッジ時間 7,587 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
22,768 KB
testcase_01 WA -
testcase_02 AC 82 ms
22,876 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 81 ms
22,924 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 81 ms
20,896 KB
testcase_19 WA -
testcase_20 AC 81 ms
23,020 KB
testcase_21 WA -
testcase_22 AC 81 ms
22,792 KB
testcase_23 WA -
testcase_24 AC 86 ms
22,944 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 82 ms
22,828 KB
testcase_28 AC 81 ms
22,948 KB
testcase_29 AC 82 ms
22,824 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 81 ms
22,920 KB
testcase_33 AC 81 ms
24,876 KB
testcase_34 AC 83 ms
26,976 KB
testcase_35 AC 81 ms
22,844 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) F# Compiler version 11.0.0.0 for F# 5.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

ソースコード

diff #

open System
open System.Collections.Generic

[<AutoOpen>]
module Cin =
    let read f = stdin.ReadLine() |> f
    let reada f = stdin.ReadLine().Split() |> Array.map f

    let readInts() =
        read string
        |> Seq.toArray
        |> Array.map (fun x -> Convert.ToInt32(x.ToString()))

module Util =
    let strRev s =
        s
        |> Seq.rev
        |> Seq.map string
        |> String.concat ""

[<EntryPoint>]
let main _ =
    let N = read int
    let AB = Array.zeroCreate (N - 1)
    for i in 0 .. N - 2 do
        AB.[i] <- reada int

    let asum = AB |> Array.sumBy (fun ab -> ab.[0])
    let bsum = AB |> Array.sumBy (fun ab -> ab.[1])
    let diff = asum - bsum
    let lim = asum
    let ans = lim - diff + 1
    printfn "%d" ans
    0 // return an integer exit code
0