結果
| 問題 | No.70 睡眠の重要性! | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2020-06-09 06:06:44 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 536 bytes | 
| コンパイル時間 | 2,614 ms | 
| コンパイル使用メモリ | 192,024 KB | 
| 最終ジャッジ日時 | 2025-01-11 00:26:17 | 
| ジャッジサーバーID (参考情報) | judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | WA * 6 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:17:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   17 |     scanf(" %d:%d %d:%d", &h1, &m1, &h2, &m2);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            
            ソースコード
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(int)(n); i++)
const double PI = acos(-1);
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n; cin >> n;
  int sum = 0;
  REP (i, n) {
    int h1, m1, h2, m2;
    scanf(" %d:%d %d:%d", &h1, &m1, &h2, &m2);
    cerr << h1 << " " << m1 << " " << h2 << " " << m2 << endl;
    int t1 = 60 * h1 + m1;
    int t2 = 60 * h2 + m2;
    int d = t2 - t1;
    if (d < 0)
      d += 60 * 24;
    sum += d;
  }
  cout << sum << endl;
  
  return 0;
}
            
            
            
        