結果

問題 No.296 n度寝
ユーザー shiCanoko_oshiCanoko_o
提出日時 2019-07-13 17:08:51
言語 Perl
(5.38.2)
結果
WA  
実行時間 -
コード長 767 bytes
コンパイル時間 209 ms
コンパイル使用メモリ 5,460 KB
実行使用メモリ 4,764 KB
最終ジャッジ日時 2023-08-14 09:40:12
合計ジャッジ時間 1,058 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 2 ms
4,532 KB
testcase_04 AC 3 ms
4,716 KB
testcase_05 AC 2 ms
4,632 KB
testcase_06 AC 3 ms
4,672 KB
testcase_07 AC 3 ms
4,652 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 2 ms
4,656 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 2 ms
4,676 KB
testcase_14 WA -
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;
        my $remainder = $minutes - 59;
        $minutes -= $remainder;
        
        for ($count_hour = 0; $minutes >= 60; $count_hour++){
            $minutes -= 60;
        }

        $hour += $count_hour;

        if ($hour >= 24) {
            my $remainder = $hour - 23;
            $hour -= $remainder;
            $hour = $hour % 24;
        }
    }
}

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