Start: Dec, 27, 2015 17:15:00
2015年秋学期《程序设计基础》第三次上机考试
End: Dec, 27, 2015 20:45:00
Time elapsed:
Time remaining:

Problem_ID: G
Result: Accepted
Time: 23ms
Memory: 1172kB
Author: 2015210402010
In contest: 1043

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

 int main()
 {
	 int s[1000];
	 char s1[1000][100],
	 s2[1000][100];
 int m,t,i,j,k,l,a,b,n,length;
 scanf("%d",&n);
 for (i=0;i<n;i++)
 { scanf("%s",&s1[i]);
   scanf("%d",&s[i]);  }
 scanf("%d",&m);
  for (i=0;i<m;i++)
  {scanf("%s",s2[i]);}
  a=0;b=0;
  for (i=0;i<m;i++)
	  for (j=0;j<n;j++)
	  {
		  length=strlen(s2[i]);
		  b=0;a=0;
		  for(k=0;k<length;k++) 
		  {if (s2[i][k]!=s1[j][k]) b=1;}
		  if (b==0)
		{
			for (l=0;l<n;l++)
			{
				if (s[j]<s[l]) a=a+1;
			}
			printf("%d\n",a);
		}
	  }
 
 return 0;
 }