結果
| 問題 | No.70 睡眠の重要性! | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2019-07-26 15:17:03 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 5,000 ms | 
| コード長 | 366 bytes | 
| コンパイル時間 | 2,297 ms | 
| コンパイル使用メモリ | 193,044 KB | 
| 最終ジャッジ日時 | 2025-01-07 07:34:39 | 
| ジャッジサーバーID (参考情報) | judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 6 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:10:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |         scanf("%d:%d %d:%d", &h1, &m1, &h2, &m2);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            
            ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    int n; cin >> n;
    int ans = 0;
    while (n--) {
        int h1, m1, h2, m2;
        scanf("%d:%d %d:%d", &h1, &m1, &h2, &m2);
        m1 = h1*60+m1;
        m2 = h2*60+m2;
        if (m1 > m2) m2 += 24*60;
        ans += m2 - m1;
    }
    cout << ans << endl;
    return 0;
}
            
            
            
        