結果
問題 | No.70 睡眠の重要性! |
ユーザー | koyumeishi |
提出日時 | 2014-11-18 23:34:18 |
言語 | C++11 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 792 bytes |
コンパイル時間 | 664 ms |
コンパイル使用メモリ | 74,616 KB |
実行使用メモリ | 4,380 KB |
最終ジャッジ日時 | 2023-08-30 21:40:30 |
合計ジャッジ時間 | 1,215 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge14 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,380 KB |
testcase_01 | AC | 2 ms
4,376 KB |
testcase_02 | AC | 2 ms
4,376 KB |
testcase_03 | AC | 2 ms
4,376 KB |
testcase_04 | AC | 1 ms
4,380 KB |
testcase_05 | AC | 1 ms
4,376 KB |
ソースコード
#include <iostream> #include <vector> #include <cstdio> #include <sstream> #include <map> #include <string> #include <algorithm> #include <queue> #include <cmath> using namespace std; int func(const string &s){ //cerr << s << endl; stringstream ss; ss << s; int ret; ss >> ret; return ret; } int main(){ int n; cin >> n; int ans = 0; for(int i=0; i<n; i++){ int H,M,h,m; string a,b; cin >> a >> b; auto pos = a.find(':'); H = func( a.substr(0, pos) ); M = func( a.substr(pos+1) ); pos = b.find(':'); h = func( b.substr(0, pos) ); m = func( b.substr(pos+1) ); m -= M; if(m < 0){ m += 60; h--; } h -= H; if(h < 0){ h += 24; } ans += m + h*60; } cout << ans << endl; return 0; }