結果

問題 No.70 睡眠の重要性!
ユーザー mrc1031mrc1031
提出日時 2016-10-11 12:09:44
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 27 ms / 5,000 ms
コード長 966 bytes
コンパイル時間 860 ms
コンパイル使用メモリ 106,476 KB
実行使用メモリ 26,012 KB
最終ジャッジ日時 2024-05-01 19:15:47
合計ジャッジ時間 1,349 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
26,008 KB
testcase_01 AC 23 ms
23,968 KB
testcase_02 AC 22 ms
22,068 KB
testcase_03 AC 22 ms
23,920 KB
testcase_04 AC 21 ms
26,012 KB
testcase_05 AC 20 ms
24,092 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;

class Program
{
    static void Main(string[] args)
    {
        // No.70 睡眠の重要性!

        int N = int.Parse(Console.ReadLine());
        string sleep = "";
        DateTime timeFrom, timeTo;
        TimeSpan sleepSum = new TimeSpan();

        for (int i = 1; i <= N; i++)
        {
            sleep = Console.ReadLine();

            timeFrom = new DateTime(1, 1, 1,
                int.Parse(sleep.Split(' ')[0].Split(':')[0]),
                int.Parse(sleep.Split(' ')[0].Split(':')[1]),
                0);
            timeTo = new DateTime(1, 1, 1,
                int.Parse(sleep.Split(' ')[1].Split(':')[0]),
                int.Parse(sleep.Split(' ')[1].Split(':')[1]),
                0);
            if (timeFrom > timeTo) timeTo = timeTo.AddDays(1);

            sleepSum += timeTo - timeFrom;
        }

        Console.WriteLine((sleepSum.Days * 24 + sleepSum.Hours) * 60 + sleepSum.Minutes);
    }
}
0