PTA 乙级 1038 统计同成绩学生

代码实现:

#include<stdio.h>

int main()
{
	int N, score[101], K;

	scanf("%d", &N);
	for (int i = 0; i < 101; i++)score[i] = 0;
	for (int i = 0; i < N; i++)
	{
		int score1;
		scanf("%d", &score1);
		score[score1]++;
	}
	scanf("%d", &K);
	for (int i = 0; i < K; i++)
	{
		int target;
		scanf("%d", &target);
		printf("%d", score[target]);
		if (i != K - 1)printf(" ");
	}

	return 0;
}

没有更多推荐了,返回首页