結果

問題 No.70 睡眠の重要性!
ユーザー しらゆきしらゆき
提出日時 2015-12-26 08:49:01
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 26 ms / 5,000 ms
コード長 791 bytes
コンパイル時間 962 ms
コンパイル使用メモリ 106,068 KB
実行使用メモリ 24,056 KB
最終ジャッジ日時 2023-10-19 04:00:16
合計ジャッジ時間 1,639 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

using System;

class Program
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        int[] H = new int[n];
        int[] M = new int[n];
        int[] h = new int[n];
        int[] m = new int[n];
        for (int i = 0; i < n; i++)
        {
            string[] s = Console.ReadLine().Split();
            H[i] = int.Parse(s[0].Split(':')[0]);
            M[i] = int.Parse(s[0].Split(':')[1]);
            h[i] = int.Parse(s[1].Split(':')[0]);
            m[i] = int.Parse(s[1].Split(':')[1]);
        }

        int sleep = 0;

        for (int i = 0; i < n; i++)
        {
            if (H[i] > h[i] || (H[i] == h[i] && M[i] > m[i])) h[i] += 24;
            sleep += h[i] * 60 + m[i] - H[i] * 60 - M[i];
        }

        Console.WriteLine(sleep);
    }
}
0