結果

問題 No.70 睡眠の重要性!
ユーザー kaito_tateyama
提出日時 2017-08-08 05:52:07
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 983 bytes
コンパイル時間 635 ms
コンパイル使用メモリ 67,752 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-11 23:05:51
合計ジャッジ時間 1,107 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 6
権限があれば一括ダウンロードができます

ソースコード

diff #
プレゼンテーションモードにする

#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <fstream>
using namespace std;
vector<string> split(const string& input, char delimiter) {
istringstream stream(input);
string field;
vector<string> result;
while (getline(stream, field, delimiter)) {
result.push_back(field);
}
return result;
}
int main() {
int n,sum;
sum = 0;
cin >> n;
for (int i = 0; i < n; i++) {
string x,y;
cin >> x >> y;
//xsplit
//cout << split(x, ':')[1] << "\n";
int hx = stoi(split(x,':')[0]);
int mx = stoi(split(x,':')[1]);
int hy = stoi(split(y,':')[0]);
int my = stoi(split(y,':')[1]);
//cout << hx << "\n";
int st = hx * 60 + mx;
int en = hy * 60 + my;
//cout << hx << " " << st << "\n";
if(en - st < 0){
sum += 1440 + en - st;
}else{
sum += en - st;
}
//cout << sum << "\n";
}
cout << sum << "\n";
return 0;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0