結果
| 問題 |
No.652 E869120 and TimeZone
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-02-23 22:42:35 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 572 bytes |
| コンパイル時間 | 829 ms |
| コンパイル使用メモリ | 53,756 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-12-17 13:20:59 |
| 合計ジャッジ時間 | 1,496 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 7 WA * 23 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:23:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
23 | scanf("%d %d %s", &a, &b, S);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
//typedef pair<int,int> P;
int main(){
int a;
int b;
char S[100];
char num[100];
double utc;
scanf("%d %d %s", &a, &b, S);
strncpy(num, S+4, strlen(S)-4);
sscanf(num,"%lf", &utc);
if(S[3]=='-') utc *= -1;
utc -= 9;
int m = b + (int)(60*utc);
int h = a;
if(m < 0){
m += 60;
h -= 1;
}
h += m/60;
m %= 60;
if(h<0) h+= 24;
h %= 24;
printf("%02d:%02d\n", h, m);
return 0;
}