結果
| 問題 |
No.70 睡眠の重要性!
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-08-05 06:38:44 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 953 bytes |
| コンパイル時間 | 919 ms |
| コンパイル使用メモリ | 81,832 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-15 10:56:04 |
| 合計ジャッジ時間 | 1,685 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 6 |
ソースコード
#include <iostream> //cin, cout
#include <vector> //vector
#include <algorithm> //sort,min,max
#include <string> //string
#include <ios> //fixed
#include <iomanip> //setprecision
#include <utility> //swap
#include <cstdlib> //abs(int)
#include <sstream> //stringstream,getline
using namespace std;
inline vector<string> Split_String(const string& str, const char key) {
vector<std::string> result;
stringstream SS(str);
string temp;
while (getline(SS, temp, key)) {
result.push_back(temp);
}
return(result);
}
int main() {
int N;
cin >> N;
string temp;
vector<string> A, B;
int h = 0, m = 0;
for (int i = 0; i < N; i++) {
cin >> temp;
A = Split_String(temp, ':');
cin >> temp;
B = Split_String(temp, ':');
h += (stoi(B[0]) + 24 - stoi(A[0])) % 24;
if (stoi(B[1]) < stoi(A[1])) {
h--;
if (h < 0) {
h = 23;
}
}
m += (stoi(B[1]) + 60 - stoi(A[1])) % 60;
}
cout << h * 60 + m << endl;
return 0;
}