結果

問題 No.652 E869120 and TimeZone
ユーザー yuruhiyayuruhiya
提出日時 2019-02-06 18:33:52
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 1,545 bytes
コンパイル時間 698 ms
コンパイル使用メモリ 93,296 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-02 05:32:11
合計ジャッジ時間 1,950 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 1 ms
4,380 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 2 ms
4,376 KB
testcase_25 AC 1 ms
4,380 KB
testcase_26 AC 1 ms
4,380 KB
testcase_27 AC 1 ms
4,376 KB
testcase_28 AC 1 ms
4,376 KB
testcase_29 AC 2 ms
4,380 KB
testcase_30 AC 2 ms
4,376 KB
testcase_31 AC 1 ms
4,380 KB
testcase_32 AC 2 ms
4,380 KB
testcase_33 AC 1 ms
4,376 KB
testcase_34 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:67:12: warning: ‘i’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   while (i < sz(s)) { n2 = n2 * 10 + (s[i] - '0'); i++; }
            ^

ソースコード

diff #

#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <array>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>
#include <stack>
#include <utility>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <bitset>
#include <random>
#include <ctime>
#include <functional>
#include <sstream>
#include <iomanip>

using namespace std;

#define rep(i, n) for(int i=0; i<(n); i++)
#define FOR(i, m, n) for(int i=(m);i<(n);i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define REVE(x) reverse((x).begin(),(x).end())
#define mp make_pair
#define pb push_back

typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef long long LL;

int main() {
	int a, b;
	string s;
	cin >> a >> b >> s;

	bool p, d = false;
	if (s[3] == '+')p = true;
	else p = false;
	rep(i, sz(s))if (s[i] == '.')d = true;

	int n1 = 0, n2 = 0;

	//n1
	{
		int i = 4;
		while (i < sz(s) && s[i] != '.') { n1 = n1 * 10 + (s[i] - '0'); i++; }
	}
	//n2
	if (d) {
		int i;
		rep(j, sz(s))if (s[j] == '.')i = j + 1;
		while (i < sz(s)) { n2 = n2 * 10 + (s[i] - '0'); i++; }
	}

	if (!p) { n1 *= -1; n2 *= -1; }
	if (!d)d = -1;

	a -= 9;
	if (d)b += 6 * n2;
	a += n1;


	a--;
	b += 60;
	a += b / 60;
	b %= 60;
	a = (a + 24) % 24;
	printf("%02d:%02d\n", a, b);
}
0