結果
| 問題 | No.70 睡眠の重要性! | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2020-08-05 06:32:47 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 920 bytes | 
| コンパイル時間 | 825 ms | 
| コンパイル使用メモリ | 81,708 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-09-15 10:42:52 | 
| 合計ジャッジ時間 | 1,406 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 5 WA * 1 | 
ソースコード
#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;
}
            
            
            
        