結果
問題 | No.652 E869120 and TimeZone |
ユーザー | uafr_cs |
提出日時 | 2018-02-23 22:36:47 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 126 ms / 1,000 ms |
コード長 | 2,658 bytes |
コンパイル時間 | 2,618 ms |
コンパイル使用メモリ | 78,128 KB |
実行使用メモリ | 41,208 KB |
最終ジャッジ日時 | 2024-06-11 12:18:46 |
合計ジャッジ時間 | 8,014 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 113 ms
40,916 KB |
testcase_01 | AC | 106 ms
40,948 KB |
testcase_02 | AC | 108 ms
40,788 KB |
testcase_03 | AC | 105 ms
40,536 KB |
testcase_04 | AC | 110 ms
40,832 KB |
testcase_05 | AC | 90 ms
39,824 KB |
testcase_06 | AC | 94 ms
40,028 KB |
testcase_07 | AC | 97 ms
40,404 KB |
testcase_08 | AC | 103 ms
41,016 KB |
testcase_09 | AC | 106 ms
40,964 KB |
testcase_10 | AC | 108 ms
40,844 KB |
testcase_11 | AC | 109 ms
40,572 KB |
testcase_12 | AC | 103 ms
40,800 KB |
testcase_13 | AC | 97 ms
40,668 KB |
testcase_14 | AC | 105 ms
40,808 KB |
testcase_15 | AC | 100 ms
40,940 KB |
testcase_16 | AC | 109 ms
40,884 KB |
testcase_17 | AC | 109 ms
40,020 KB |
testcase_18 | AC | 121 ms
40,980 KB |
testcase_19 | AC | 126 ms
41,208 KB |
testcase_20 | AC | 124 ms
41,032 KB |
testcase_21 | AC | 125 ms
41,128 KB |
testcase_22 | AC | 122 ms
41,076 KB |
testcase_23 | AC | 124 ms
40,976 KB |
testcase_24 | AC | 125 ms
40,944 KB |
testcase_25 | AC | 98 ms
40,868 KB |
testcase_26 | AC | 98 ms
40,728 KB |
testcase_27 | AC | 97 ms
40,996 KB |
testcase_28 | AC | 95 ms
40,544 KB |
testcase_29 | AC | 106 ms
40,728 KB |
testcase_30 | AC | 92 ms
40,576 KB |
testcase_31 | AC | 95 ms
39,752 KB |
testcase_32 | AC | 99 ms
40,724 KB |
testcase_33 | AC | 107 ms
40,600 KB |
testcase_34 | AC | 102 ms
40,600 KB |
ソースコード
import java.io.BufferedReader; import java.io.Closeable; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.LinkedList; import java.util.StringTokenizer; public class Main { public static final long INF = Long.MAX_VALUE / 2 -1; public static void main(String[] args) throws IOException { try (Scanner sc = new Scanner(System.in)) { final int h = sc.nextInt(); final int m = sc.nextInt(); int minutes = h * 60 + m; String str = sc.next().substring(3); if(str.charAt(0) == '-'){ str = str.substring(1); if(str.indexOf(".") < 0){ minutes -= 60 * (Integer.parseInt(str) + 9); }else{ minutes -= 60 * (Integer.parseInt(str.substring(0, str.indexOf("."))) + 9); final String lower = str.substring(str.indexOf(".") + 1); minutes -= 6 * Integer.parseInt(lower); } while(minutes < 0){ minutes += 60 * 24; } }else{ if(str.indexOf(".") < 0){ minutes += 60 * (Integer.parseInt(str) - 9); }else{ minutes += 60 * (Integer.parseInt(str.substring(0, str.indexOf("."))) - 9); final String lower = str.substring(str.indexOf(".") + 1); minutes += 6 * Integer.parseInt(lower); } while(minutes < 0){ minutes += 60 * 24; } } System.out.printf("%02d:%02d\n", (minutes / 60) % 24, minutes % 60); } } public static class Scanner implements Closeable { private BufferedReader br; private StringTokenizer tok; public Scanner(InputStream is) throws IOException { br = new BufferedReader(new InputStreamReader(is)); } private void getLine() throws IOException { while (!hasNext()) { tok = new StringTokenizer(br.readLine()); } } private boolean hasNext() { return tok != null && tok.hasMoreTokens(); } public String next() throws IOException { getLine(); return tok.nextToken(); } public int nextInt() throws IOException { return Integer.parseInt(next()); } public long nextLong() throws IOException { return Long.parseLong(next()); } public double nextDouble() throws IOException { return Double.parseDouble(next()); } public int[] nextIntArray(int n) throws IOException { final int[] ret = new int[n]; for (int i = 0; i < n; i++) { ret[i] = this.nextInt(); } return ret; } public long[] nextLongArray(int n) throws IOException { final long[] ret = new long[n]; for (int i = 0; i < n; i++) { ret[i] = this.nextLong(); } return ret; } public void close() throws IOException { br.close(); } } }