結果
| 問題 |
No.652 E869120 and TimeZone
|
| コンテスト | |
| ユーザー |
tecchaxn
|
| 提出日時 | 2018-02-23 22:49:36 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 1,010 bytes |
| コンパイル時間 | 1,296 ms |
| コンパイル使用メモリ | 161,444 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-12-17 13:22:48 |
| 合計ジャッジ時間 | 2,099 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 27 WA * 3 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:34:19: warning: ‘d’ may be used uninitialized in this function [-Wmaybe-uninitialized]
34 | int dh=(int)(d*60)/60;
| ~~^~~~
ソースコード
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define INF 1e18
#define SIZE 100005
using namespace std;
typedef pair<int,int> P;
//-----------------------------------------------------------------------
signed main()
{
int a,b; cin>>a>>b;
string s,t; cin>>s;
t=s.substr(4);
double d;
if(s[3]=='-'){
if(t.size()==1) d=t[0]-'0';
if(t.size()==2) d=(t[0]-'0')*10+(t[1]-'0');
if(t.size()==3) d=(t[0]-'0')+(double)(t[2]-'0')/10;
if(t.size()==4) d=(t[0]-'0')*10+(t[1]-'0')+(double)(t[3]-'0')/10;
d=24-d;
}
else{
if(t.size()==1) d=t[0]-'0';
if(t.size()==2) d=(t[0]-'0')*10+(t[1]-'0');
if(t.size()==3) d=(t[0]-'0')+(double)(t[2]-'0')/10;
if(t.size()==4) d=(t[0]-'0')*10+(t[1]-'0')+(double)(t[3]-'0')/10;
}
int dh=(int)(d*60)/60;
int dm=(int)(d*60)%60;
b+=dm; if(b>=60) b-=60,a++;
a=(a+dh+15)%24;
printf("%02d:%02d\n",a,b);
}
tecchaxn