結果

問題 No.652 E869120 and TimeZone
ユーザー YamaKasaYamaKasa
提出日時 2018-09-30 22:17:45
言語 Java21
(openjdk 21)
結果
AC  
実行時間 219 ms / 1,000 ms
コード長 1,285 bytes
コンパイル時間 2,602 ms
コンパイル使用メモリ 77,364 KB
実行使用メモリ 61,880 KB
最終ジャッジ日時 2023-09-02 05:32:05
合計ジャッジ時間 10,632 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 196 ms
59,336 KB
testcase_01 AC 201 ms
58,480 KB
testcase_02 AC 193 ms
59,248 KB
testcase_03 AC 196 ms
59,392 KB
testcase_04 AC 195 ms
59,584 KB
testcase_05 AC 210 ms
59,348 KB
testcase_06 AC 197 ms
59,496 KB
testcase_07 AC 203 ms
58,712 KB
testcase_08 AC 205 ms
59,260 KB
testcase_09 AC 192 ms
59,392 KB
testcase_10 AC 200 ms
58,916 KB
testcase_11 AC 206 ms
59,468 KB
testcase_12 AC 198 ms
59,400 KB
testcase_13 AC 196 ms
59,528 KB
testcase_14 AC 189 ms
58,732 KB
testcase_15 AC 204 ms
59,348 KB
testcase_16 AC 219 ms
59,844 KB
testcase_17 AC 203 ms
58,700 KB
testcase_18 AC 186 ms
58,660 KB
testcase_19 AC 184 ms
59,192 KB
testcase_20 AC 191 ms
59,056 KB
testcase_21 AC 205 ms
58,884 KB
testcase_22 AC 195 ms
61,880 KB
testcase_23 AC 197 ms
59,684 KB
testcase_24 AC 205 ms
59,160 KB
testcase_25 AC 209 ms
59,696 KB
testcase_26 AC 197 ms
57,532 KB
testcase_27 AC 203 ms
59,112 KB
testcase_28 AC 200 ms
59,788 KB
testcase_29 AC 203 ms
59,364 KB
testcase_30 AC 193 ms
58,816 KB
testcase_31 AC 217 ms
58,832 KB
testcase_32 AC 203 ms
58,932 KB
testcase_33 AC 198 ms
57,260 KB
testcase_34 AC 204 ms
59,452 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String h = scan.next();
		String m = scan.next();
		String t = scan.next();
		scan.close();
		int H;
		int M;
		double k;
		if(h.charAt(0) == '0') {
			H = Integer.parseInt(h.substring(1, 2));
		}else {
			H = Integer.parseInt(h.substring(0, 2));
		}
		if(m.charAt(0) == '0') {
			M = Integer.parseInt(m.substring(1, 2));
		}else {
			M = Integer.parseInt(m.substring(0, 2));
		}
		if(t.charAt(4) == '0') {
			k = Double.parseDouble(t.substring(3, t.length()));
		}else {
			k = Double.parseDouble(t.substring(3, t.length()));
		}

		SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
        Date date = new Date();
        try {
        	String s = H + ":" + M;
        	date = sdf.parse(s);
        }catch(ParseException e) {
            e.printStackTrace();
        }

        int d = (int)Math.round(k * 60) - 540;
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        calendar.add(Calendar.MINUTE, d);
        Date d1 = calendar.getTime();
        System.out.println(sdf.format(d1));
	}
}
0