結果
| 問題 | No.70 睡眠の重要性! | 
| コンテスト | |
| ユーザー |  stone_725 | 
| 提出日時 | 2015-01-03 04:09:19 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 5,000 ms | 
| コード長 | 1,122 bytes | 
| コンパイル時間 | 1,124 ms | 
| コンパイル使用メモリ | 156,728 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-06-13 01:13:17 | 
| 合計ジャッジ時間 | 1,780 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 6 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:36:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   36 |   scanf("%d", &n);
      |   ~~~~~^~~~~~~~~~
main.cpp:39:12: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   39 |       scanf("%d:%d %d:%d", &a1, &a2, &b1, &b2);
      |       ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            
            ソースコード
//include
#include<bits/stdc++.h>
//using
using namespace std;
//define static const typedef
#define FOR(i, s, n) for(int (i) = (s); (i) < (n); (i)++)
#define REP(i, n) FOR((i), 0, (n))
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SORT(a) sort(ALL(a))
#define RSORT(a) sort(RALL(a))
#define DUMP(x) cerr << #x << " = " << x << "\n";
#define DEBUG(x) cerr << #x << " = " << x << " (L:" << __LINE__ << ") " << __FILE__ << "\n";
#define F first
#define S second
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned long long ULL;
static const int INF = 1 << 25;
int n, ans = 0, a, b, a1, a2, b1, b2;
int main(){
  scanf("%d", &n);
  for (int i = 0; i < n; ++i)
    {
      scanf("%d:%d %d:%d", &a1, &a2, &b1, &b2);
      a = a1 * 60 + a2;
      b = b1 * 60 + b2;
      if (a > b){
	b += 60 * 24;
      }
      ans += b - a;
    }
  printf("%d\n", ans);
    return 0;
}
            
            
            
        