Cod sursa(job #3166980)

Utilizator Alexbora13Bora Ioan Alexandru Alexbora13 Data 9 noiembrie 2023 20:56:33
Problema Grupuri Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.52 kb
#include <bits/stdc++.h>
#define START ios::sync_with_stdio(false); fin.tie(NULL); fout.tie(NULL);
#define STOP fin.close(); fout.close(); return 0;
#define MAX 100000
using namespace std;

ifstream fin("grupuri.in");
ofstream fout("grupuri.out");

int nr, n, sum;
int v[MAX+1];

int main()
{
    START
    fin >> nr >> n;
    for(int i=1; i<=n; i++)
    {
        fin  >> v[i];
        sum+=v[i];
    }
    sort(v+1,v+1+n);
    int div = sum/nr;
    fout << upper_bound(v+1,v+1+n,div)-v-1;
    STOP
}