結果
| 問題 |
No.70 睡眠の重要性!
|
| コンテスト | |
| ユーザー |
LV3zJigVW57oPGy
|
| 提出日時 | 2022-11-09 12:31:34 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 783 bytes |
| コンパイル時間 | 1,421 ms |
| コンパイル使用メモリ | 161,308 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-22 18:50:00 |
| 合計ジャッジ時間 | 1,910 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 1 WA * 5 |
コンパイルメッセージ
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(b<d){
f=fabs(b-d);
}
else if(d<b){
f=fabs(60-b+d);
}
count += e*60+f;
}
cout << count;
}
LV3zJigVW57oPGy