PAT乙级1038

题目链接

坑点

用cin、cout超时了,所以选择了scanf和printf
#include 
#include 
using namespace std;


int main(int argc, char** argv) {
	int allScore[100000]={0};
	int N,score,searchNum,searchScore;
	scanf("%d",&N);
	while(N--)
	{
		cin>>score;
		allScore[score]+=1;
	}
	cin>>searchNum;
	while(searchNum--)
	{
		scanf("%d",&searchScore);
	
		if(searchNum==0)
		{
		
			printf("%d",allScore[searchScore]);
		}
			
		else
			printf("%d ",allScore[searchScore]);
	}
	
	return 0;
}

你可能感兴趣的:(PAT乙级)