結果
| 問題 | No.70 睡眠の重要性! | 
| コンテスト | |
| ユーザー |  kya_ski | 
| 提出日時 | 2020-04-20 21:42:55 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 5,000 ms | 
| コード長 | 499 bytes | 
| コンパイル時間 | 1,551 ms | 
| コンパイル使用メモリ | 166,088 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-10-06 09:16:37 | 
| 合計ジャッジ時間 | 2,133 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 6 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n;
    cin >> n;
    
    int ans = 0;
    for (int _ = 0; _ < n; _++) {
        int a, b, c, d;
        scanf("%d:%d", &a, &b);
        scanf("%d:%d", &c, &d);
        if (a > c) c += 24;
        else if (a == c and b > d) c += 24;
        
        int h = c - a;
        int m = d - b;
        if (m < 0) { m += 60; h--; }
        int res = h * 60 + m;
        ans += res;
    }
    
    cout << ans << '\n';
    
    return 0;
}
            
            
            
        