結果
| 問題 | No.70 睡眠の重要性! | 
| コンテスト | |
| ユーザー |  LV3zJigVW57oPGy | 
| 提出日時 | 2022-11-09 12:35:43 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 5,000 ms | 
| コード長 | 791 bytes | 
| コンパイル時間 | 1,641 ms | 
| コンパイル使用メモリ | 160,728 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-07-22 18:53:50 | 
| 合計ジャッジ時間 | 2,135 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 6 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:50:31: warning: ‘f’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   50 |                  count += e*60+f;
      |                           ~~~~^~
            
            ソースコード
#include <bits/stdc++.h> 
using namespace std;
#include <ios>
#include <iomanip>
#include <iostream>
#include <string>
#include <algorithm>
int main(){
  double count=0;
  int number;
  cin >> number;
  for(int i=0; i<number; i++){
  stringstream ss;
  string str;
  cin >> str;
  int a, b;
  ss << str;
  ss >> a;
  ss.ignore();
  ss >> b;
  stringstream ss2;
  string str2;
  cin >> str2;
  int d, c;
  ss2 << str2;
  ss2 >> c;
  ss2.ignore();
  ss2 >> d;
  double e;
  double f;
    if(a>=12&&c<a){
      e=(23-a)+c;
    }
    else if(a==c&&d<b){
    e=23;
    }
    else if(a==c){
      e=fabs(a-c);
    }
    else{
      e=fabs(a-c)-1;
    }
    	if(d<b||a!=c){
     	 f=fabs(60-b+d);
        }
    	else if(b<d){
     	 f=fabs(b-d);
    	}
 		 count += e*60+f;
  }	
  cout << count;
}
            
            
            
        