結果
問題 | No.70 睡眠の重要性! |
ユーザー |
![]() |
提出日時 | 2017-07-02 13:59:33 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 402 bytes |
コンパイル時間 | 643 ms |
コンパイル使用メモリ | 56,888 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-05 07:27:38 |
合計ジャッジ時間 | 911 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 6 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:9:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 9 | scanf("%d", &n); | ~~~~~^~~~~~~~~~ main.cpp:14:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 14 | scanf("%d:%d %d:%d", &h, &m, &ht, &mt); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include<iostream>#include<cstdio>#include<string>#include<algorithm>using namespace std;int main() {int n, h, m, ht, mt;scanf("%d", &n);int ans = 0;for (int i = 0; i < n; i++){scanf("%d:%d %d:%d", &h, &m, &ht, &mt);int a = h * 60 + m;int b = ht * 60 + mt;if (b > a){ans += (b - a);}else{ans += (b + 1440 - a);}}cout << ans << endl;return 0;}