結果

問題 No.652 E869120 and TimeZone
ユーザー YamaKasa
提出日時 2018-09-30 22:01:51
言語 Java
(openjdk 23)
結果
AC  
実行時間 126 ms / 1,000 ms
コード長 843 bytes
コンパイル時間 2,706 ms
コンパイル使用メモリ 78,272 KB
実行使用メモリ 54,304 KB
最終ジャッジ日時 2024-06-11 12:28:14
合計ジャッジ時間 7,020 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String h = scan.next();
		String m = scan.next();
		String t = scan.next();
		scan.close();
		int H;
		int M;
		double k;
		if(h.charAt(0) == '0') {
			H = Integer.parseInt(h.substring(1, 2));
		}else {
			H = Integer.parseInt(h.substring(0, 2));
		}
		if(m.charAt(0) == '0') {
			M = Integer.parseInt(m.substring(1, 2));
		}else {
			M = Integer.parseInt(m.substring(0, 2));
		}
		if(t.charAt(4) == '0') {
			k = Double.parseDouble(t.substring(3, t.length()));
		}else {
			k = Double.parseDouble(t.substring(3, t.length()));
		}

		//System.out.println(H +" " + M +" " + k);

		int e = H * 60 + M - 540 + 1440 * 2 + (int)Math.round(k * 60);
		e = e % 1440;
		System.out.printf("%02d:%02d\n", e/60, e%60);
	}
}
0