結果

問題 No.70 睡眠の重要性!
ユーザー swdamdrswdamdr
提出日時 2017-02-14 16:23:37
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,030 bytes
コンパイル時間 2,167 ms
コンパイル使用メモリ 104,676 KB
実行使用メモリ 23,668 KB
最終ジャッジ日時 2023-08-28 16:50:19
合計ジャッジ時間 3,157 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
19,576 KB
testcase_01 AC 57 ms
21,524 KB
testcase_02 AC 58 ms
21,616 KB
testcase_03 AC 57 ms
21,668 KB
testcase_04 AC 58 ms
23,668 KB
testcase_05 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args)
    {
        int n = int.Parse(Console.ReadLine());

        int hour = 0;
        int minute = 0;

        string[] time;
        int[] before;
        int[] after;

        for (int i = 0; i < n; i++)
        {
            time = Console.ReadLine().Split();
            before = time[0].Split(':').Select(v => int.Parse(v)).ToArray();
            after = time[1].Split(':').Select(v => int.Parse(v)).ToArray();

            if (after[0] < before[0])
            {
                hour += 24 - before[0];
                hour += after[0];
            }
            else
            {
                hour += after[0] - before[0];
            }

            if (after[1] != before[1])
            {
                hour--;
                minute += 60 - before[1];
                minute += after[1];
            }
        }

        Console.WriteLine(hour * 60 + minute);
        Console.ReadLine();

    }
}
0