結果

問題 No.652 E869120 and TimeZone
ユーザー Daigo HIROOKA
提出日時 2018-06-12 01:52:19
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 800 bytes
コンパイル時間 4,129 ms
コンパイル使用メモリ 79,472 KB
実行使用メモリ 55,236 KB
最終ジャッジ日時 2024-06-30 13:49:29
合計ジャッジ時間 10,196 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 25 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class No652{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();
		String xx = sc.next();
		if(!xx.contains(".")){
			xx.concat(".0");
		}
		double x;
		if(xx.contains("+")){
			x = Double.parseDouble(xx.substring(4));
		}else{
			x = -Double.parseDouble(xx.substring(4));
		}
		double diff = x - 9.0;
		int a_diff = (int)((diff*60)/60);
		int b_diff = (int)((diff*60)%60);

		int a_new = a + a_diff;
		int b_new = b + b_diff;
		if(b_new >= 60){
			b_new -= 60;
			a_new += 1;
		}else if(b_new < 0){
			b_new += 60;
			a_new -= 1;
		}
		if(a_new >= 24) a_new -= 24;
		else if(a_new < 0) a_new += 24;

		System.out.println(String.format("%02d", a_new) + ":" + String.format("%02d", b_new));
	}
}
0