QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#136763 | #245. Time Zone | wtn135687# | 100 ✓ | 143ms | 3656kb | C++20 | 765b | 2023-08-09 11:03:19 | 2023-08-09 11:03:23 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
const double eps = 1e-6;
int get(double x){
for(int i=x-2;i<=x+2;i++){
if(abs(x-i)<eps)return i;
}
assert(0);
return 0;
}
inline void solve(){
double x;int h,m;
scanf("%lld %lld UTC%lf",&h,&m,&x);
x-=8;
x*=60;
m+=get(x);
while(m<0){
m+=60;h--;if(h<0)h+=24;
}
while(m>=60){
m-=60;h++;if(h>=24)h-=24;
}
printf("%02lld:%02lld\n",h,m);
}
signed main(){
// ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
int WTN666=1;cin>>WTN666;
while(WTN666--){
solve();
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 143ms
memory: 3656kb
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