結果

問題 No.296 n度寝
ユーザー YamaKasa
提出日時 2018-05-02 00:57:07
言語 Java
(openjdk 23)
結果
AC  
実行時間 126 ms / 1,000 ms
コード長 633 bytes
コンパイル時間 2,070 ms
コンパイル使用メモリ 74,020 KB
実行使用メモリ 54,260 KB
最終ジャッジ日時 2024-06-28 00:17:40
合計ジャッジ時間 4,494 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int H = scan.nextInt();
		int M = scan.nextInt();
		int T = scan.nextInt();
		scan.close();

		int t = H * 60 +  M;
		int max = 24 * 60;
		int k = ((N - 1) * T) % max;
		//System.out.println(k);
		int m = 0;
		if(k <= max - t) {
			m = t + k;
		}else {
			m = k - (max - t);
		}
		int ans1 = m / 60;
		int ans2 = m % 60;
		if(ans1 == 24) {
			System.out.println(0);
			System.out.println(0);
			System.exit(0);
		}
		System.out.println(ans1);
		System.out.println(ans2);
	}
}
0