結果

問題 No.70 睡眠の重要性!
ユーザー t8m8⛄️t8m8⛄️
提出日時 2015-03-14 20:30:47
言語 Java21
(openjdk 21)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,603 bytes
コンパイル時間 3,512 ms
コンパイル使用メモリ 74,688 KB
実行使用メモリ 49,884 KB
最終ジャッジ日時 2023-09-11 08:20:22
合計ジャッジ時間 4,565 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
49,512 KB
testcase_01 AC 45 ms
49,540 KB
testcase_02 AC 44 ms
49,884 KB
testcase_03 AC 46 ms
49,480 KB
testcase_04 AC 45 ms
49,412 KB
testcase_05 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

//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));}
}
0