結果

問題 No.70 睡眠の重要性!
ユーザー バカらっくバカらっく
提出日時 2018-03-02 09:54:18
言語 Swift
(5.10.0)
結果
AC  
実行時間 4 ms / 5,000 ms
コード長 434 bytes
コンパイル時間 1,396 ms
コンパイル使用メモリ 129,196 KB
実行使用メモリ 8,236 KB
最終ジャッジ日時 2023-08-20 10:23:05
合計ジャッジ時間 1,998 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
8,224 KB
testcase_01 AC 3 ms
8,120 KB
testcase_02 AC 4 ms
8,236 KB
testcase_03 AC 3 ms
8,184 KB
testcase_04 AC 3 ms
8,180 KB
testcase_05 AC 4 ms
8,184 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.swift:10:5: warning: immutable value 'i' was never used; consider replacing with '_' or removing it
for i in 1...inputCount {
    ^
    _

ソースコード

diff #

func dateValue(_ inpt:String) ->Int {
    let tmp = inpt.split(separator: ":").map{Int($0)!}
    return tmp[0]*60+tmp[1]
}

let inputCount = Int(readLine()!)!

var ans:Int = 0

for i in 1...inputCount {
    let inpt = readLine()!.split(separator: " ").map(String.init)
    let stTime = dateValue(inpt[0])
    var edTime = dateValue(inpt[1])
    if(edTime<stTime) {
        edTime+=1440
    }
    ans += (edTime - stTime)
}

print(ans)
0