結果
| 問題 | No.70 睡眠の重要性! | 
| コンテスト | |
| ユーザー |  Yut176 | 
| 提出日時 | 2016-10-07 23:00:25 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 5,000 ms | 
| コード長 | 1,233 bytes | 
| コンパイル時間 | 789 ms | 
| コンパイル使用メモリ | 73,620 KB | 
| 実行使用メモリ | 6,820 KB | 
| 最終ジャッジ日時 | 2024-11-21 19:57:40 | 
| 合計ジャッジ時間 | 1,417 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 6 | 
ソースコード
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<map>
#include<queue>
#include<string>
#include<sstream>
#include<cmath>
using namespace std;
int main(){
  int n;
  cin >> n;
  int ans = 0;
  for(int i=0; i<n; i++){
    string a, b;
    cin >> a >> b;
    bool fl = false;
    int s = 0, g = 0;
    if( a[1] == ':' ){
      if( a.size() == 3 ){
        s += (a[0]-'0') * 60 + (a[2]-'0');
      }else{
        s += (a[0]-'0') * 60 + (a[2]-'0') * 10 + (a[3]-'0');
      }
    }else{
      if( a.size() == 4 ){
        s += (a[0]-'0') * 60 * 10 + (a[1]-'0') * 60 + (a[3]-'0');
      }else{
        s += (a[0]-'0') * 60 * 10 + (a[1]-'0') * 60 + (a[3]-'0') * 10 + (a[4]-'0');
      }
    }
    if( b[1] == ':' ){
      if( b.size() == 3 ){
        g += (b[0]-'0') * 60 + (b[2]-'0');
      }else{
        g += (b[0]-'0') * 60 + (b[2]-'0') * 10 + (b[3]-'0');
      }
    }else{
      if( b.size() == 4 ){
        g += (b[0]-'0') * 60 * 10 + (b[1]-'0') * 60 + (b[3]-'0');
      }else{
        g += (b[0]-'0') * 60 * 10 + (b[1]-'0') * 60 + (b[3]-'0') * 10 + (b[4]-'0');
      }
    }
    if( s > g ){
      g += 1440;
    }
    ans += (g - s);
  }
  cout << ans << endl;
  return 0;
}
            
            
            
        