結果
問題 | No.70 睡眠の重要性! |
ユーザー |
![]() |
提出日時 | 2015-06-16 21:08:41 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 778 bytes |
コンパイル時間 | 548 ms |
コンパイル使用メモリ | 79,044 KB |
実行使用メモリ | 6,940 KB |
最終ジャッジ日時 | 2024-07-07 03:20:04 |
合計ジャッジ時間 | 1,021 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 6 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:31:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 31 | scanf("%d:%d %d:%d", &H, &M, &h, &m); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <algorithm> #include <cstdio> #include <cstdlib> #include <cctype> #include <cmath> #include <iostream> #include <queue> #include <list> #include <map> #include <numeric> #include <set> #include <sstream> #include <string> #include <vector> using namespace std; #define REP(i,a,n) for(int i=(a); i<(int)(n); i++) #define rep(i,n) REP(i,0,n) #define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it) #define ALLOF(c) (c).begin(), (c).end() typedef long long ll; int main(){ int N; cin >> N; int ret = 0; rep(i,N){ char c; int H,M,h,m; scanf("%d:%d %d:%d", &H, &M, &h, &m); int a = H * 60 + M; int b = h * 60 + m; if(a > b){ b += 60 * 24; } ret += b - a; } cout << ret << endl; return 0; }