A - Olympiad CodeForces - 937A

题目链接:https://vjudge.net/problem/CodeForces-937A
 

这题就用set存一下,输出长度就行了。

#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<set>

using namespace std;
const int N = 105;
int n,x;
set<int> st;
int main()
{
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		scanf("%d",&x);
		if(x) st.insert(x);
	}
	printf("%d\n",st.size());
	return 0;
 } 

猜你喜欢

转载自blog.csdn.net/qq_40816078/article/details/89713774