Skip to content

Instantly share code, notes, and snippets.

@moo1o
Created April 14, 2017 09:23
Show Gist options
  • Save moo1o/40470234b92ce6027006523a1005d590 to your computer and use it in GitHub Desktop.
Save moo1o/40470234b92ce6027006523a1005d590 to your computer and use it in GitHub Desktop.
//
// 11053.cpp
// AlgorithmTest
//
// Created by 김무열 on 2017. 4. 14..
// Copyright © 2017년 김무열. All rights reserved.
//
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(void){
int n, cnt = 1;
cin >> n;
vector<int> a(n);
for(int i = 0 ; i< n ; i++){
cin >> a[i];
}
sort(a.begin(), a.end());
reverse(a.begin(), a.end());
for(int i = 1; i<n ; i++){
if(a[i] < a[i-1]){
++cnt;
}
}
cout << cnt << '\n';
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment