結果
問題 |
No.652 E869120 and TimeZone
|
ユーザー |
![]() |
提出日時 | 2018-02-24 01:11:32 |
言語 | Java (openjdk 23) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 923 bytes |
コンパイル時間 | 2,373 ms |
コンパイル使用メモリ | 77,124 KB |
実行使用メモリ | 57,024 KB |
最終ジャッジ日時 | 2024-12-17 13:40:55 |
合計ジャッジ時間 | 8,521 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 5 |
other | AC * 25 WA * 5 |
ソースコード
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(); //日本の時刻(分) int japan = h*60+m; //X国の時刻を求める //余計な部分を取り除く double dif = Double.parseDouble(s.replaceAll("[UTC+]","")); //日本時間の9を引いてやることによって、 //X国の現在時刻が日本とどれだけずれているかが求まる。 dif = (dif-9.0)*60; //X国の時刻(分) int x = japan+(int)dif; //以下、これを時と分の表記に直す x %= 1440; if (x<0) { x += 1440; } int H = x/60; int M = x%60; //直せたので、あとは出力するだけ String ans = ""; if (H < 10) {ans += "0";} ans += H + ":"; if (M < 10) {ans += "0";} ans += M; System.out.println(ans); } }