結果
| 問題 | No.70 睡眠の重要性! | 
| コンテスト | |
| ユーザー |  IL_msta | 
| 提出日時 | 2015-05-31 11:45:23 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 5,000 ms | 
| コード長 | 1,180 bytes | 
| コンパイル時間 | 514 ms | 
| コンパイル使用メモリ | 65,516 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-07-06 12:54:41 | 
| 合計ジャッジ時間 | 918 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 6 | 
ソースコード
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
/////////
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define P(p) cout<<(p)<<endl;
/////////
typedef long long LL;
typedef long double LD;
/////////
using namespace::std;
/////////
int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed;//
	//cout << setprecision(7);//
	
	int N;
	cin>>N;
	int aH[30],aM[30];
	int bH[30],bM[30];
	string Astr,Bstr;
	rep(k,N){
		cin>>Astr>>Bstr;
		int i=0;
		aH[k] = 0;
		aM[k] = 0;
		bH[k] = 0;
		bM[k] = 0;
		for(i=0;Astr[i] != ':';++i){
			aH[k] = aH[k]*10 + Astr[i] - '0';
		}
		++i;
		for(;i<Astr.size();++i){
			aM[k] = aM[k]*10 + Astr[i] - '0';
		}
		for(i=0;Bstr[i] != ':';++i){
			bH[k] = bH[k]*10 + Bstr[i] - '0';
		}
		++i;
		for(;i<Bstr.size();++i){
			bM[k] = bM[k]*10 + Bstr[i] - '0';
		}
	}
	/*
	for(int i=0;i<N;++i){
		cout << aH[i] << ":" << aM[i] << " " << bH[i] << ":" << bM[i] << endl;
	}*/
	////////////////
	int ans  = 0;
	int neru = 0;
	int oki  = 0;
	rep(i,N){
		neru = aH[i]*60+aM[i];
		oki  = bH[i]*60+bM[i];
		if(neru > oki){
			oki += 24*60;
		}
		ans += oki-neru;
	}
	P(ans);
	return 0;
}
            
            
            
        