結果
問題 | No.70 睡眠の重要性! |
ユーザー |
|
提出日時 | 2020-06-09 06:12:13 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 489 bytes |
コンパイル時間 | 2,175 ms |
コンパイル使用メモリ | 191,748 KB |
最終ジャッジ日時 | 2025-01-11 00:26:58 |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 6 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:14:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 14 | 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() { 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; } printf("%d\n", sum); return 0; }