結果

問題 No.296 n度寝
ユーザー dazy
提出日時 2017-04-10 14:54:53
言語 Java
(openjdk 23)
結果
AC  
実行時間 149 ms / 1,000 ms
コード長 572 bytes
コンパイル時間 3,388 ms
コンパイル使用メモリ 75,976 KB
実行使用メモリ 55,104 KB
最終ジャッジ日時 2024-07-18 05:40:47
合計ジャッジ時間 6,050 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Run {
    public static void main (String arg[]) {
        Scanner scan = new Scanner(System.in);

        int N = scan.nextInt();
        int H = scan.nextInt();
        int M = scan.nextInt();
        int T = scan.nextInt();

        int Th = T/60;
        int Tm = T%60;

        for (int i = 0; i < N - 1; i++) {
            M += Tm;
            if (M > 59) {
                H++;
                M %= 60;
            }
            H += Th;
            if (H > 23) H %= 24;
        }

        System.out.println(H + "\n" + M);
    }
}
0