結果
問題 | No.70 睡眠の重要性! |
ユーザー |
![]() |
提出日時 | 2018-04-08 11:56:39 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 444 bytes |
コンパイル時間 | 634 ms |
コンパイル使用メモリ | 63,928 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-26 20:19:30 |
合計ジャッジ時間 | 1,608 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 6 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:14:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 14 | scanf("%d:%d",&H,&M); | ~~~~~^~~~~~~~~~~~~~~ main.cpp:16:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 16 | scanf("%d:%d",&h,&m); | ~~~~~^~~~~~~~~~~~~~~
ソースコード
#include <iostream> #include <vector> #include <algorithm> #include <math.h> #define ALL(x) (x).begin(),(x).end() using namespace std; int main(){ int n,ans = 0; cin >> n; for(int i = 0;i < n;i++){ int H,M,h,m; scanf("%d:%d",&H,&M); H = H*60+M; scanf("%d:%d",&h,&m); h = h*60+m; if(h > H)ans += h - H; else ans += 1440 - H + h; } cout << ans << endl; return 0; }