Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<vector>
- #include<algorithm>
- using namespace std;
- int main(){
- int n,k;
- cin >> n >> k;
- vector <int> v(n);
- for(int i=0;i<n;++i){
- cin >> v[i];
- }
- sort(v.begin(),v.end());
- int numero=0;
- int sumador=0;
- for(int j=0;j<k;++j){
- int i=0;
- if(v[i]==numero){
- ++sumador;
- ++i;
- }
- cout << numero << ":" << sumador << "," << " ";
- ++numero;
- sumador=0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement