結果

問題 No.296 n度寝
ユーザー shiCanoko_oshiCanoko_o
提出日時 2019-07-13 11:25:54
言語 Perl
(5.38.2)
結果
TLE  
実行時間 -
コード長 689 bytes
コンパイル時間 365 ms
コンパイル使用メモリ 5,356 KB
実行使用メモリ 4,792 KB
最終ジャッジ日時 2023-08-13 22:39:38
合計ジャッジ時間 4,631 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 689 ms
4,608 KB
testcase_01 AC 211 ms
4,600 KB
testcase_02 AC 10 ms
4,636 KB
testcase_03 AC 2 ms
4,756 KB
testcase_04 AC 2 ms
4,596 KB
testcase_05 AC 3 ms
4,600 KB
testcase_06 AC 2 ms
4,612 KB
testcase_07 TLE -
testcase_08 AC 4 ms
4,540 KB
testcase_09 AC 2 ms
4,664 KB
testcase_10 AC 3 ms
4,600 KB
testcase_11 AC 2 ms
4,604 KB
testcase_12 WA -
testcase_13 AC 2 ms
4,512 KB
testcase_14 AC 3 ms
4,628 KB
testcase_15 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.pl syntax OK

ソースコード

diff #

my $input = <>;
chomp ($input);

my @input = split (/ /, $input);

my $sleeps = $input[0];
my $hour = $input[1];
my $minutes = $input[2];
my $interval = $input[3];


#何度寝と間隔から時間を求める
if ($sleeps > 0){
    $sleeps -= 1;
    my $get_up_time = $interval * $sleeps;
    $minutes += $get_up_time;
    if ($minutes >= 60){
        my $count_hour;
        for ($count_hour = 0; $minutes >= 60; $count_hour++){
            $minutes -= 60;
        }

        $hour += $count_hour;

        if ($hour > 24) {
            for (my $count_day = 0; $hour >= 24; $count_day++){
                $hour -= 24;
            }
        }
    }
}

print "$hour\n";
print "$minutes\n";
0