結果

問題 No.70 睡眠の重要性!
ユーザー LV3zJigVW57oPGyLV3zJigVW57oPGy
提出日時 2022-11-09 12:35:43
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 791 bytes
コンパイル時間 2,396 ms
コンパイル使用メモリ 146,496 KB
実行使用メモリ 4,376 KB
最終ジャッジ日時 2023-09-30 00:57:02
合計ジャッジ時間 2,351 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:50:18: warning: ‘f’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     count += e*60+f;
              ~~~~^~

ソースコード

diff #

#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;
}
0