結果

問題 No.652 E869120 and TimeZone
ユーザー Tsukasa_Type
提出日時 2018-02-23 22:44:47
言語 Java
(openjdk 23)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 616 bytes
コンパイル時間 2,459 ms
コンパイル使用メモリ 77,672 KB
実行使用メモリ 57,212 KB
最終ジャッジ日時 2024-12-17 13:22:26
合計ジャッジ時間 9,107 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 25 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int h = sc.nextInt();
		int m = sc.nextInt();
		String s = sc.next();
		s = s.replaceAll("[UTC+]","");
		double t = Double.parseDouble(s)-9.0;
		//tがマイナスなら時間を戻す。プラスなら進める。
		t *= 60;
		
		int ans = (h*60+m)+(int)t;
		
		if (ans<0) {
			while (ans<0) {
				ans += 1440;
			}
		}
		
		int H = ans/60;
		H %= 24;
		
		int M = ans%60;
		
		String x = "";
		if (H<10) {x+="0";}
		x+=H+":";
		if (M<10) {x+="0";}
		x+=M;
		System.out.println(x);
	}
}
0