結果
| 問題 | No.652 E869120 and TimeZone | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2018-02-23 22:47:43 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                WA
                                 
                            (最新) 
                                AC
                                 
                            (最初) | 
| 実行時間 | - | 
| コード長 | 575 bytes | 
| コンパイル時間 | 352 ms | 
| コンパイル使用メモリ | 53,932 KB | 
| 実行使用メモリ | 6,824 KB | 
| 最終ジャッジ日時 | 2024-12-17 13:22:30 | 
| 合計ジャッジ時間 | 1,413 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 5 | 
| other | AC * 25 WA * 5 | 
コンパイルメッセージ
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;
	while(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;
}
            
            
            
        