QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#136619 | #245. Time Zone | Team_name# | 100 ✓ | 298ms | 3764kb | C++23 | 615b | 2023-08-09 09:24:22 | 2023-08-09 09:24:24 |
Judging History
answer
#include <cmath>
#include <iomanip>
#include <iostream>
#include <sstream>
void solve()
{
int a, b; std::cin >> a >> b;
std::string s; std::cin >> s;
std::stringstream s_s(s.substr(3));
double t; s_s >> t;
int t_a = std::floor(t), t_b = std::round((t - t_a) * 60);
b += t_b;
if (b >= 60) b -= 60, ++t_a;
t_a -= 8;
a += t_a;
if (a < 0) a += 24;
if (a >= 24) a -= 24;
std::cout << std::setfill('0') << std::setw(2) << a << ":" << std::setw(2) << b << "\n";
}
int main()
{
std::ios_base::sync_with_stdio(false), std::cin.tie(nullptr);
int T; std::cin >> T;
while (T--) solve();
}
詳細信息
Test #1:
score: 100
Accepted
time: 298ms
memory: 3764kb
input:
406080 0 0 UTC+0 0 0 UTC-0 0 0 UTC+0.1 0 0 UTC-0.1 0 0 UTC+0.2 0 0 UTC-0.2 0 0 UTC+0.3 0 0 UTC-0.3 0 0 UTC+0.4 0 0 UTC-0.4 0 0 UTC+0.5 0 0 UTC-0.5 0 0 UTC+0.6 0 0 UTC-0.6 0 0 UTC+0.7 0 0 UTC-0.7 0 0 UTC+0.8 0 0 UTC-0.8 0 0 UTC+0.9 0 0 UTC-0.9 0 0 UTC+1 0 0 UTC-1 0 0 UTC+1.1 0 0 UTC-1.1 0 0 UTC+1.2 0...
output:
16:00 16:00 16:06 15:54 16:12 15:48 16:18 15:42 16:24 15:36 16:30 15:30 16:36 15:24 16:42 15:18 16:48 15:12 16:54 15:06 17:00 15:00 17:06 14:54 17:12 14:48 17:18 14:42 17:24 14:36 17:30 14:30 17:36 14:24 17:42 14:18 17:48 14:12 17:54 14:06 18:00 14:00 18:06 13:54 18:12 13:48 18:18 13:42 18:24 13:36 ...
result:
ok 406080 lines