結果
| 問題 |
No.70 睡眠の重要性!
|
| コンテスト | |
| ユーザー |
mikorice
|
| 提出日時 | 2018-03-04 11:36:52 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,255 bytes |
| コンパイル時間 | 812 ms |
| コンパイル使用メモリ | 88,612 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-07 03:33:33 |
| 合計ジャッジ時間 | 1,131 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 5 WA * 1 |
ソースコード
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
vector<string> split(string s, string delim) {
vector<string> res;
int pos = 0;
while(true) {
int found = s.find(delim, pos);
if(found >= 0) {
res.push_back(s.substr(pos, found - pos));
}
else {
res.push_back(s.substr(pos));
break;
}
pos = found + delim.size();
}
return res;
}
int main() {
int n,ans;
cin >> n;
string a,b;
vector<string> a0,b0;
string thresh = ":";
ans = 0;
int a1,a2,b1,b2;
int hr,mn;
REP(i,n){
cin >> a >> b;
a0 = split(a, thresh);
b0 = split(b, thresh);
a1 = stoi(a0[0]);
a2 = stoi(a0[1]);
b1 = stoi(b0[0]);
b2 = stoi(b0[1]);
hr = b1-a1;
if(hr < 0) hr += 24;
mn = b2-a2;
if(mn < 0){
mn += 60;
hr -= 1;
}
ans += mn + hr*60;
}
cout << ans << endl;
return 0;
}
mikorice