QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#136634#245. Time ZoneRd_rainydays#100 ✓87ms3876kbC++20812b2023-08-09 09:32:162023-08-09 09:32:20

Judging History

This is the latest submission verdict.

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-08-09 09:32:20]
  • Judged
  • Verdict: 100
  • Time: 87ms
  • Memory: 3876kb
  • [2023-08-09 09:32:16]
  • Submitted

answer

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int n;
int main(){
  scanf("%d",&n);
  for(int i=1;i<=n;i++){
    int a,b;
    scanf("%d%d",&a,&b);
    char s=getchar();
    int x=0;
    while(s!='+'&&s!='-')s=getchar();
    int op=1;
    if(s=='+')op=1;
    else op=-1;
    s=getchar();
    while(isdigit(s)){x=x*10+s-'0';s=getchar();}
    int d=0;
    double tp=6;
    // putchar(s);
    if(s=='.'){
      s=getchar();
      while(s!='\n'){
     int pl=s-'0';
     d=d+(int)(1.0*tp*pl+0.5);
     tp/=10;
     s=getchar();
    }
    }
    // cout<<"???"<<x<<" "<<op<<" "<<d<<endl;
    a=(a-8+op*x+24)%24;
    b=(b+op*d);
    if(b>=60)a++,b-=60;
    else if(b<0)a--,b+=60;
    a=(a+24)%24;
    printf("%02d:%02d\n",a,b);
  }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 87ms
memory: 3876kb

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