結果

問題 No.70 睡眠の重要性!
ユーザー mrc1031mrc1031
提出日時 2016-10-11 12:09:44
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 58 ms / 5,000 ms
コード長 966 bytes
コンパイル時間 2,026 ms
コンパイル使用メモリ 104,984 KB
実行使用メモリ 22,728 KB
最終ジャッジ日時 2023-08-14 06:30:36
合計ジャッジ時間 2,991 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
20,616 KB
testcase_01 AC 58 ms
20,740 KB
testcase_02 AC 58 ms
22,728 KB
testcase_03 AC 58 ms
20,796 KB
testcase_04 AC 58 ms
20,704 KB
testcase_05 AC 58 ms
22,724 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