QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#39236#245. Time ZonewyhaoAC ✓125ms1956kbC++837b2022-07-09 09:41:052022-07-09 09:41:06

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-07-09 09:41:06]
  • 评测
  • 测评结果:AC
  • 用时:125ms
  • 内存:1956kb
  • [2022-07-09 09:41:05]
  • 提交

answer

#include<cstdio>
#include<cstring>
using namespace std;
int T,a,b,c,d,n,m;
char ch[20];
int main(){
	scanf("%d",&T);
	while(T--){
		scanf("%d%d%s",&a,&b,ch+1);
		n=strlen(ch+1);m=0;
		for(int i=1;i<=n;i++){
			if(ch[i]=='.') m=i;
		}
		if(m==0){
			if('0'<=ch[6] and ch[6]<='9'){
				c=(ch[5]-'0')*10+ch[6]-'0';
				d=0;
			}else{
				c=ch[5]-'0';
				d=0;
			}
		}else{
			if(m==7){
				c=(ch[5]-'0')*10+ch[6]-'0';
				d=0;
				for(int i=8;i<=n;i++){
					d=d*10+ch[i]-'0';
				}
			}else{
				c=ch[5]-'0';
				d=0;
				for(int i=7;i<=n;i++){
					d=d*10+ch[i]-'0';
				}
			}
		}
		a-=8;
		if(ch[4]=='+'){
			a+=c;
			b+=d*6;
		}else{
			a-=c;
			b-=d*6;
		}
		if(b<0){
			a--;b+=60;
		}
		if(b>59){
			a++;b-=60;
		}
		a=(a%24+24)%24;
		printf("%02d:%02d\n",a,b);
	}
	return 0;
} 

详细

Test #1:

score: 100
Accepted
time: 125ms
memory: 1956kb

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