QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#136940 | #245. Time Zone | PanC_ake | 100 ✓ | 169ms | 3772kb | C++17 | 629b | 2023-08-09 14:22:34 | 2023-08-09 14:22:36 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
void solve() {
int h, m;
scanf("%d %d", &h, &m);
getchar();
double y = h * 60 + m;
char c1, c2, c3, c4;
double x;
scanf("%c%c%c%lf", &c1, &c2, &c3, &x);
// if (c4 == '-') x *= -1;
x -= 8;
y += x * 60;
while (y < 0) y += 1440;
while (y >= 1440) y -= 1440;
int hh = (int)y / 60;
int mm = (y - 60 * hh + 0.5);
if (mm == 60) mm = 0, hh++;
if (hh == 24) hh = 0;
printf("%02d:%02d\n", hh, mm);
}
signed main() {
int t = 1;
scanf("%d", &t);
while (t--) {
solve();
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 169ms
memory: 3772kb
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