結果
| 問題 | No.70 睡眠の重要性! | 
| コンテスト | |
| ユーザー |  mmn15277198 | 
| 提出日時 | 2020-08-06 02:21:44 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 5,000 ms | 
| コード長 | 857 bytes | 
| コンパイル時間 | 1,040 ms | 
| コンパイル使用メモリ | 97,360 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-09-18 22:13:01 | 
| 合計ジャッジ時間 | 1,531 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 6 | 
ソースコード
#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;
}
            
            
            
        