现在的位置: 首页 > 综合 > 正文

浙大PAT 1006题 1006. Sign In and Sign Out

2018年05月26日 ⁄ 综合 ⁄ 共 385字 ⁄ 字号 评论关闭

谁是开门人和谁是锁门人,简单地模拟题。

#include<stdio.h>
#include<string.h>
int main(){
	char lkman[20],unlkman[20];
	char id[20],in[20],out[20];
	char fst[20]={"24:00:00"},last[20]={"00:00:00"};
	int i,j,n;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s %s %s",id,in,out);
		if(strcmp(in,fst)<0){
			strcpy(fst,in);
			strcpy(unlkman,id);
		}
		if(strcmp(out,last)>0){
			strcpy(last,out);
			strcpy(lkman,id);
		}
	}
	printf("%s %s\n",unlkman,lkman);
	return 0;
}

抱歉!评论已关闭.