A. Olympiad
The recent All-berland Olympiad in Informatics featured n participants with each scoring a certain amount of points.
As the head of the programming committee, you is to determine the set of participants to is awarded with diplomas with RE SPECT to the following criteria:at least one participant should get a diploma. None of those with score equal to zero should get awarded. When someone was awarded, all participants with score not less than he score should also be awarded.
Determine the number of ways to choose a subset of participants that would receive the diplomas. Input
The first line contains a single integer n (1≤n≤100)-the number of participants.
The next line contains a sequence of n integers a1, a2, ..., an (0≤ai≤600)-participants ' scores.
It's guaranteed in least one participant has Non-zero score. Output
Print a single integer-the desired number of ways. Examples input Copy
4
1 3) 3 2
Output
3
Input Copy
3
1 1 1
Output
1
Input Copy
4
42 0) 0 42
Output
1
Test instructions: There are n individuals, you can set the bar, so that all people not less than this score award, 0 points can not win the prize, ask you how many ways to divide.
Idea: It is obvious that there are several different numbers, that is, a few fraction division method, note 0 Except, you can use the set container to weight, directly output set the number of elements is the answer.
#include <bits/stdc++.h>
#define LL Long long
using namespace std;
set<ll>st;
ll N,x,ans;
int main ()
{
while (~scanf ("%lld", &n))
{
st.clear ();
for (ll i=1;i<=n;i++)
{
scanf ("%lld", &x);
if (x==0) continue;
St.insert (x);
}
Ans=st.size ();
printf ("%lld\n", ans);
}
return 0;
}