結果
| 問題 | No.70 睡眠の重要性! | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2022-09-08 11:40:12 | 
| 言語 | C# (.NET 8.0.404) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 55 ms / 5,000 ms | 
| コード長 | 1,084 bytes | 
| コンパイル時間 | 14,596 ms | 
| コンパイル使用メモリ | 166,292 KB | 
| 実行使用メモリ | 182,868 KB | 
| 最終ジャッジ日時 | 2024-11-24 05:04:55 | 
| 合計ジャッジ時間 | 9,371 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 6 | 
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (105 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/
ソースコード
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;
class Program
{
    static void Main()
    {
        /*3
          22:24 5:9
          22:46 5:37
          1:11 7:11
        */
        int N = int.Parse(Console.ReadLine());
        string[] HMhm;
        int[] hm;
        TimeSpan time, sTime, eTime;
        int sleepTime = 0;
        for ( int i = 0; i < N; i++)
        {
            // 睡眠時間を取得
            HMhm = Console.ReadLine().Split(' ');
            
            // 就寝時間を取得
            hm = HMhm[0].Split(':').Select(int.Parse).ToArray();
            sTime = new TimeSpan(hm[0], hm[1], 0);
            // 起床時間を取得
            hm = HMhm[1].Split(':').Select(s => int.Parse(s)).ToArray();
            eTime = new TimeSpan(hm[0], hm[1], 0);
            time = (eTime - sTime < new TimeSpan(0, 0, 0) ? eTime - sTime + new TimeSpan(24, 0, 0) : eTime - sTime);
            sleepTime += time.Hours * 60 + time.Minutes;
        }
        Console.WriteLine(sleepTime);
    }
}
            
            
            
        