hdu 1234

把時間當字符串處理比較簡單,換成秒較麻煩。

#include <stdio.h>
#include <string.h>

typedef struct no 
{
	char name[16];
	char in[10];
	char out[10];
}no;

int main()
{
	int n,m,i;
	no temp,first,last;
	
	scanf("%d",&n);
	while(n--)
	{
		scanf("%d",&m);
		for(i=0;i<m;i++)
		{
			scanf("%s %s %s",&temp.name,&temp.in,&temp.out);
			if(i==0)
			{
				first=last=temp;
			}
			if(strcmp(temp.in,first.in)<0)
				first=temp;
			if(strcmp(temp.out,last.out)>0)
				last=temp;
		}
		printf("%s %s\n",first.name,last.name);
	}

	return 0;
}


發佈了57 篇原創文章 · 獲贊 0 · 訪問量 1萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章