結果
問題 |
No.70 睡眠の重要性!
|
ユーザー |
![]() |
提出日時 | 2015-03-14 20:30:47 |
言語 | Java (openjdk 23) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,603 bytes |
コンパイル時間 | 3,760 ms |
コンパイル使用メモリ | 78,716 KB |
実行使用メモリ | 37,332 KB |
最終ジャッジ日時 | 2024-06-28 22:53:46 |
合計ジャッジ時間 | 4,307 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 5 WA * 1 |
ソースコード
//No.70 睡眠の重要性! import java.util.*; import java.io.*; import static java.util.Arrays.*; import static java.lang.Math.*; public class No70 { static final InputStream in = System.in; static final PrintWriter out = new PrintWriter(System.out,false); static void solve() throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); int ans = 0; while (n-- > 0) { String[] input = br.readLine().split(" "); int h1 = Integer.parseInt(input[0].split(":")[0]); int m1 = Integer.parseInt(input[0].split(":")[1]); int h2 = Integer.parseInt(input[1].split(":")[0]); int m2 = Integer.parseInt(input[1].split(":")[1]); if (h1 >= h2) { if (m1 >= m2) { ans += (24-h1+h2-1)*60 + 60-(m1-m2); }else { ans += (24-h1+h2)*60 + (m2-m1); } }else { if (m1 >= m2) { ans += (h2-h1-1)*60 + 60-(m1-m2); }else { ans += (h2-h1)*60 + (m2-m1); } } } out.println(ans); } public static void main(String[] args) throws Exception { long start = System.currentTimeMillis(); solve(); out.flush(); long end = System.currentTimeMillis(); //trace(end-start + "ms"); in.close(); } static void trace(Object... o) { System.out.println(deepToString(o));} }