結果

問題 No.70 睡眠の重要性!
ユーザー aaaaaaiu
提出日時 2019-07-26 15:13:43
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
RE  
実行時間 -
コード長 362 bytes
コンパイル時間 1,681 ms
コンパイル使用メモリ 191,776 KB
最終ジャッジ日時 2025-01-07 07:34:31
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other RE * 6
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:10:17: warning: format ‘%d’ expects argument of type ‘int*’, but argument 2 has type ‘int’ [-Wformat=]
   10 |         scanf("%d:%d %d:%d", h1, m1, h2, m2);
      |                ~^            ~~
      |                 |            |
      |                 int*         int
main.cpp:10:20: warning: format ‘%d’ expects argument of type ‘int*’, but argument 3 has type ‘int’ [-Wformat=]
   10 |         scanf("%d:%d %d:%d", h1, m1, h2, m2);
      |                   ~^             ~~
      |                    |             |
      |                    int*          int
main.cpp:10:23: warning: format ‘%d’ expects argument of type ‘int*’, but argument 4 has type ‘int’ [-Wformat=]
   10 |         scanf("%d:%d %d:%d", h1, m1, h2, m2);
      |                      ~^              ~~
      |                       |              |
      |                       int*           int
main.cpp:10:26: warning: format ‘%d’ expects argument of type ‘int*’, but argument 5 has type ‘int’ [-Wformat=]
   10 |         scanf("%d:%d %d:%d", h1, m1, h2, m2);
      |                         ~^               ~~
      |                          |               |
      |                          int*            int
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);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:10:14: warning: ‘h1’ may be used uninitialized [-Wmaybe-uninitialized]
   10 |         scanf("%d:%d %d:%d", h1, m1, h2, m2);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:9:13: note: ‘h1’ was declared here
    9 |         int h1, m1, h2, m2;
      |             ^~
main.cpp:10:14: warning: ‘h2’ may be used uninitialized [-Wmaybe-uninitialized]
   10 |         scanf("%d:%d %d:%d", h1, m1, h2, m2);
  

ソースコード

diff #

#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;
}
0