PATB 1041 考试座位号(15)

#include 
#include 
using namespace std;
struct student{
	char str[15];
	int trys;
	int tests;
}stu[1000];
int main()
{
	int n,m,query,i;
	char s[15];
	scanf("%d",&n);
	for(i = 0;i < n; i++)
	{
		//cin>>stu[i].str>>stu[i].trys>>stu[i].tests;
		scanf("%s %d %d",stu[i].str,&stu[i].trys,&stu[i].tests); 
	} 
	scanf("%d",&m);
	for(int j = 0;j < m; j++)
	{
		scanf("%d",&query);
		for(int k = 0; k < i; k++) 
		{
			if(stu[k].trys == query){
				printf("%s %d\n",stu[k].str,stu[k].tests);
				break;
			}
		}
	}
	return 0;
}

 

转载于:https://www.cnblogs.com/qiangz/p/8447206.html

你可能感兴趣的:(PATB 1041 考试座位号(15))