結果

問題 No.652 E869120 and TimeZone
ユーザー neko_the_shadow
提出日時 2019-06-05 23:18:56
言語 Java
(openjdk 23)
結果
AC  
実行時間 132 ms / 1,000 ms
コード長 647 bytes
コンパイル時間 2,233 ms
コンパイル使用メモリ 75,464 KB
実行使用メモリ 54,524 KB
最終ジャッジ日時 2024-06-11 12:29:47
合計ジャッジ時間 6,932 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.math.BigDecimal;
import java.time.LocalTime;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner stdin = new Scanner(System.in);
        int a = stdin.nextInt();
        int b = stdin.nextInt();
        String s = stdin.next();

        char op = s.charAt(3);
        BigDecimal hour = new BigDecimal(s.substring(4));
        
        long minute = hour.multiply(BigDecimal.valueOf(60)).longValue();
        if (op == '-') {
            minute *= -1;
        }
        LocalTime ans = LocalTime.of(a, b).plusMinutes(minute).minusHours(9);
        System.out.println(ans);
    }
}
0