結果

問題 No.652 E869120 and TimeZone
ユーザー Daigo HIROOKA
提出日時 2018-06-12 02:15:59
言語 Java
(openjdk 23)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 889 bytes
コンパイル時間 3,944 ms
コンパイル使用メモリ 79,976 KB
実行使用メモリ 55,320 KB
最終ジャッジ日時 2024-07-17 22:20:35
合計ジャッジ時間 9,753 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 29 WA * 1
権限があれば一括ダウンロードができます

ソースコード

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.valueOf(xx.substring(4));
		}else{
			x = -Double.valueOf(xx.substring(4));
		}
		double diff = Math.round((x-9.0)*100000)/100000.0;
		int a_diff = (int)((diff*60.0)/60.0);
		int b_diff = (int)((diff*60.0)%60.0);
		// System.out.println(diff + " " + a_diff + " " + b_diff);

		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