結果

問題 No.70 睡眠の重要性!
ユーザー guriceringuricerin
提出日時 2020-01-10 12:32:01
言語 F#
(F# 4.0)
結果
AC  
実行時間 57 ms / 5,000 ms
コード長 1,199 bytes
コンパイル時間 7,271 ms
コンパイル使用メモリ 189,792 KB
実行使用メモリ 31,232 KB
最終ジャッジ日時 2024-05-03 01:47:29
合計ジャッジ時間 8,393 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 57 ms
30,848 KB
testcase_01 AC 56 ms
30,976 KB
testcase_02 AC 57 ms
31,104 KB
testcase_03 AC 57 ms
31,104 KB
testcase_04 AC 56 ms
31,232 KB
testcase_05 AC 56 ms
30,976 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (223 ms)。
MSBuild のバージョン 17.9.6+a4ecab324 (.NET)
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

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 readChars() = read string |> Seq.toArray
    let readInts() = readChars() |> Array.map (fun x -> Convert.ToInt32(x.ToString()))

[<AutoOpen>]
module Cout =
    let writer = new IO.StreamWriter(new IO.BufferedStream(Console.OpenStandardOutput()))
    let print (s: string) = writer.Write s
    let println (s: string) = writer.WriteLine s
    let inline puts (s: ^a) = string s |> println

let toM h = h * 60

let limit = toM 24

let f (s: string array) =
    let hm1 = s
    let h1, m1 = Convert.ToInt32(hm1.[0]), Convert.ToInt32(hm1.[1])
    m1 + toM h1

let solve() =
    let n = read int
    let mutable ans = 0
    for i in 0 .. n - 1 do
        let s = reada string |> Array.map (fun x -> x.Split(':'))

        let hm1 = f s.[0]
        let hm2 = f s.[1]
        if hm1 <= hm2 then ans <- ans + (hm2 - hm1) else ans <- ans + (limit - hm1) + hm2

    puts ans
    ()

[<EntryPoint>]
let main _ =
    try
        solve()
    with e -> printfn "%s" (e.ToString())
    writer.Close()
    0 // return an integer exit code
0