結果

問題 No.70 睡眠の重要性!
ユーザー mmn15277198mmn15277198
提出日時 2020-08-06 02:21:44
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 857 bytes
コンパイル時間 1,063 ms
コンパイル使用メモリ 98,160 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-19 02:13:37
合計ジャッジ時間 1,892 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#pragma GCC optimize("Ofast")
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
#include<map>
#include<iomanip>
#include<queue>

using namespace std;

int main(){	
	
	int n;
	cin >> n;
	
	long long ans=0;
	for(int i=0;i<n;i++){
		string s,t;
		cin >> s >> t;
		int H=0,M=0;
		bool f=false;
		for(int j=0;j<s.size();j++){
			if(s[j]==':'){
				f=true;
				continue;
			}
			if(!f){
				H+=(s[j]-'0');
				H*=10;
			}else{
				M+=(s[j]-'0');
				M*=10;
			}
		}
		H/=10;
		M/=10;
		int h=0,m=0;
		f=false;
		for(int j=0;j<t.size();j++){
			if(t[j]==':'){
				f=true;
				continue;
			}
			if(!f){
				h+=(t[j]-'0');
				h*=10;
			}else{
				m+=(t[j]-'0');
				m*=10;
			}
		}
		h/=10;
		m/=10;
		int a=h*60+m;
		int b=H*60+M;
		if(a<b)a+=24*60;
	    ans+=a-b;
	}
	cout << ans << endl;	
	return 0;
}
0