結果

問題 No.70 睡眠の重要性!
ユーザー KuraKura
提出日時 2019-02-21 19:49:35
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 932 bytes
コンパイル時間 2,119 ms
コンパイル使用メモリ 62,608 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-13 02:53:54
合計ジャッジ時間 2,507 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<iostream>
#include<vector>
#include<string>
using namespace std;
int main() {
	int n;
	cin >> n;
	vector<string> e(n), f(n);
	vector<int> a(n), b(n), c(n), d(n);
	for (int i = 0; i < n; i++) {
		cin >> e[i] >> f[i];
		if (e[i][1] == ':') {
			a[i] = e[i][0] - '0';
		}
		else {
			a[i] = (e[i][0] - '0')*10+ e[i][1] - '0';
		}
		if (e[i][e[i].length()-2] == ':') {
			b[i] = e[i][e[i].length() - 1] - '0';
		}
		else {
			b[i] = (e[i][e[i].length() - 2] - '0') * 10 + e[i][e[i].length() - 1] - '0';
		}
		if (f[i][1] == ':') {
			c[i] = f[i][0] - '0';
		}
		else {
			c[i] = (f[i][0] - '0') * 10 + f[i][1] - '0';
		}
		if (f[i][f[i].length() - 2] == ':') {
			d[i] = f[i][f[i].length() - 1] - '0';
		}
		else {
			d[i] = (f[i][f[i].length() - 2] - '0') * 10 + f[i][f[i].length() - 1] - '0';
		}
	}
	int g = 0;
	for (int i = 0; i < n; i++) {
		g += ((c[i] + 23 - a[i] )* 60 + d[i] + 60 - b[i])%1440;
	}
	cout << g << endl;
}
0