結果

問題 No.296 n度寝
ユーザー matsuyoshi30matsuyoshi30
提出日時 2017-03-09 21:40:52
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 902 bytes
コンパイル時間 1,989 ms
コンパイル使用メモリ 71,960 KB
実行使用メモリ 56,324 KB
最終ジャッジ日時 2023-09-06 05:33:40
合計ジャッジ時間 4,983 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 124 ms
56,080 KB
testcase_04 AC 124 ms
56,036 KB
testcase_05 AC 125 ms
55,964 KB
testcase_06 AC 123 ms
56,028 KB
testcase_07 WA -
testcase_08 AC 129 ms
55,760 KB
testcase_09 WA -
testcase_10 AC 124 ms
55,760 KB
testcase_11 AC 124 ms
55,732 KB
testcase_12 AC 125 ms
56,080 KB
testcase_13 AC 124 ms
56,044 KB
testcase_14 AC 122 ms
55,472 KB
testcase_15 AC 125 ms
55,936 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;

class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int h = in.nextInt();
        int m = in.nextInt();
        int t = in.nextInt();

        if(n == 1) {
            System.out.println(h);
            System.out.println(m);
        } else {
            for(int i=0; i<n-1; i++) {
                m += t;
                if(m >= 60) {
                    h++;
                    m -= 60;
                }
            }
            System.out.println(h % 24);
            System.out.println(m);
        }

        // h * 60 + m + t * (n - 1)
        // int at = h * 60 + m + t * (n - 1);
        // System.out.println(at / 60 % 24);
        // System.out.println(at % 60);

        in.close();
    }
}
0