結果

問題 No.652 E869120 and TimeZone
コンテスト
ユーザー YamaKasa
提出日時 2018-09-30 22:01:51
言語 Java
(openjdk 25.0.2)
結果
AC  
実行時間 109 ms / 1,000 ms
コード長 843 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,306 ms
コンパイル使用メモリ 82,620 KB
実行使用メモリ 48,092 KB
最終ジャッジ日時 2026-01-29 13:09:16
合計ジャッジ時間 7,127 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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