結果

問題 No.296 n度寝
ユーザー n.yn.y
提出日時 2022-06-07 14:27:03
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 70 ms / 1,000 ms
コード長 1,932 bytes
コンパイル時間 834 ms
コンパイル使用メモリ 106,644 KB
実行使用メモリ 24,076 KB
最終ジャッジ日時 2023-10-21 03:49:49
合計ジャッジ時間 2,059 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 50 ms
24,076 KB
testcase_01 AC 33 ms
24,076 KB
testcase_02 AC 26 ms
24,076 KB
testcase_03 AC 26 ms
24,076 KB
testcase_04 AC 26 ms
24,076 KB
testcase_05 AC 25 ms
24,076 KB
testcase_06 AC 26 ms
24,076 KB
testcase_07 AC 70 ms
24,076 KB
testcase_08 AC 27 ms
24,076 KB
testcase_09 AC 25 ms
24,076 KB
testcase_10 AC 26 ms
24,076 KB
testcase_11 AC 26 ms
24,076 KB
testcase_12 AC 25 ms
24,076 KB
testcase_13 AC 26 ms
24,076 KB
testcase_14 AC 25 ms
24,076 KB
testcase_15 AC 26 ms
24,076 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)
        {
            string[] str = Console.ReadLine().Split(' ');

            //N度寝する
            int N = int.Parse(str[0]);
            //時
            int H = int.Parse(str[1]);
            //分
            int M = int.Parse(str[2]);
            //T分後にアラームが鳴る
            int T = int.Parse(str[3]);

            int a = 0;
            int b = 0;
            int c = 0;
            //何回で起きられるか
            a = N - 1;
            //何分後に起きるか
            b = a * T;
            //Mからbをたす 
            c = b + M;

            //何回ループするか
            int ans = c / 60;

            //60分超えたらHに+1する
            for (int i = 0; i < ans+1; i++)
            {
                //cが60超えるなら
                if (c >= 60)
                {
                    //Hをプラス1する
                    H += 1;
                    c -= 60;
                    if(c>=60)
                    {
                        continue;
                    }
                }
                if (c < 60)
                {
                    break;
                }


            }
            //24時間超えたらHを0にする
            for (int i = 0; i < ans + 1; i++)
            {
                //Hが24になったら
                if (H >= 24)
                {
                    int x = H - 24;
                    H = 0;
                    H += x;
                    if (H >= 24)
                    {
                        continue;
                    }
                }
                if(H<24)
                {
                    break;
                }
            }
            //表示 時間 分
            Console.WriteLine(H);
            Console.WriteLine(c);

        }
    }
}
0