Codeforces Round #467 (Div. 2) A. Olympiad [Enter a set of numbers, find the number of legal subsets of the sequence]

Topic link: click to enter

Just think of this method is a very simple water problem!

Code:

#include<bits/stdc++.h>
using namespace std;
int a[1001];
int main(){
    set<int>s;
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a[i];
        if(a[i]!=0){
            s.insert(a[i]);
        }
    }
    cout<<s.size()<<" ";


}

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325944423&siteId=291194637