結果

問題 No.70 睡眠の重要性!
ユーザー Y_SY_S
提出日時 2020-08-05 06:32:47
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 920 bytes
コンパイル時間 831 ms
コンパイル使用メモリ 81,328 KB
実行使用メモリ 4,352 KB
最終ジャッジ日時 2023-10-13 13:55:42
合計ジャッジ時間 1,432 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,352 KB
testcase_01 AC 2 ms
4,352 KB
testcase_02 AC 1 ms
4,352 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#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--;
		}
		m += (stoi(B[1]) + 60 - stoi(A[1])) % 60;
	}

	cout << h * 60 + m << endl;

	return 0;

}
0