結果
| 問題 |
No.70 睡眠の重要性!
|
| コンテスト | |
| ユーザー |
koyumeishi
|
| 提出日時 | 2014-11-18 23:34:18 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 5,000 ms |
| コード長 | 792 bytes |
| コンパイル時間 | 1,001 ms |
| コンパイル使用メモリ | 79,388 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2025-01-02 18:57:08 |
| 合計ジャッジ時間 | 1,435 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 6 |
ソースコード
#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;
}
koyumeishi