Cod sursa(job #1500997)
Utilizator | Data | 12 octombrie 2015 22:32:54 | |
---|---|---|---|
Problema | Zombie | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.49 kb |
#include <fstream>
using namespace std;
ifstream fin("zombie.in");
ofstream fout("zombie.out");
int D, N, K, solution, x;
int A[1000001];
int main()
{
fin >> D >> N >> K;
for(int i = 1; i <= N ;i ++)
{
fin >> x;
A[x / D] ++;
}
for(int i = 0;i <= x / D; i ++)
{
if(A[i] > K)
{
solution += K;
}
else
solution += A[i];
}
fout << solution;
return 0;
}