結果
| 問題 | No.70 睡眠の重要性! |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-10-14 04:13:40 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 611 bytes |
| 記録 | |
| コンパイル時間 | 849 ms |
| コンパイル使用メモリ | 81,668 KB |
| 実行使用メモリ | 7,972 KB |
| 最終ジャッジ日時 | 2026-05-12 09:32:15 |
| 合計ジャッジ時間 | 1,360 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 6 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:29:28: warning: 'H' may be used uninitialized [-Wmaybe-uninitialized]
29 | time_to_num(S, H, M);
| ~~~~~~~~~~~^~~~~~~~~
main.cpp:28:21: note: 'H' was declared here
28 | int H, M, h, m;
| ^
main.cpp:29:28: warning: 'M' may be used uninitialized [-Wmaybe-uninitialized]
29 | time_to_num(S, H, M);
| ~~~~~~~~~~~^~~~~~~~~
main.cpp:28:24: note: 'M' was declared here
28 | int H, M, h, m;
| ^
main.cpp:30:28: warning: 'h' may be used uninitialized [-Wmaybe-uninitialized]
30 | time_to_num(W, h, m);
| ~~~~~~~~~~~^~~~~~~~~
main.cpp:28:27: note: 'h' was declared here
28 | int H, M, h, m;
| ^
main.cpp:30:28: warning: 'm' may be used uninitialized [-Wmaybe-uninitialized]
30 | time_to_num(W, h, m);
| ~~~~~~~~~~~^~~~~~~~~
main.cpp:28:30: note: 'm' was declared here
28 | int H, M, h, m;
| ^
ソースコード
#include <iostream>
#include <cmath>
using namespace std;
void time_to_num(string T, int H, int M){
string string_H = "", string_M = "";
int now = 0;
for(int i = 0; i < T.size(); i++){
if(T[i] == ':'){
now++;
}else if(now == 0){
string_H.push_back(T[i]);
}else if(now == 1){
string_M.push_back(T[i]);
}
}
H = stoi(string_H);
M = stoi(string_M);
}
int main(){
int N;
cin >> N;
int ans = 0;
for(int i = 0; i < N; i++){
string S, W;
cin >> S >> W;
int H, M, h, m;
time_to_num(S, H, M);
time_to_num(W, h, m);
ans += (h * m + 1440 - H * M) % 1440;
}
cout << ans << endl;
}