結果

問題 No.70 睡眠の重要性!
ユーザー TDTD
提出日時 2022-06-07 09:52:59
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 28 ms / 5,000 ms
コード長 1,282 bytes
コンパイル時間 2,261 ms
コンパイル使用メモリ 106,240 KB
実行使用メモリ 24,140 KB
最終ジャッジ日時 2023-10-21 03:47:55
合計ジャッジ時間 3,107 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

using System;

namespace yukicoder
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = int.Parse(Console.ReadLine());
            int sum = 0;
            int t = 0;
            int t1 = 0;
            int m = 0;
            int m1 = 0;
            int c=0;
            int d=0;
            int e = 0;
            for(int i = 0; i < a; i++)
            {
                string[] s = Console.ReadLine().Split(' ',':');
                 t = int.Parse(s[0]);
                t1 = int.Parse(s[2]);
                 m = int.Parse(s[1]);
                 m1 = int.Parse(s[3]);

                if (m > m1)
                {
                    t1 -= 1;
                }
                if (t > t1)
                {
                    t = 24 - t;
                    c = t1 + t;
                }
                else
                {
                    c = t1 - t;
                }

                c *= 60;
                d = (60-m)+m1;//分の計算
                if (d >= 60)//分が60を超えたとき
                {
                    e=d / 60;
                    c += 60*(e-1);
                    d = d%60;
                }
                sum += c+d;
            }

            Console.WriteLine(sum);
        }
    }
}
0