Pagini recente » Cod sursa (job #2822772) | Cod sursa (job #2929421) | Cod sursa (job #2218601) | Cod sursa (job #247870) | Cod sursa (job #1089699)
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ifstream fin("numere.in");
int i,a[100],k,n,b[100],nb=1,nr,j,ok=0,p,poz,max=0;
fin>>n>>k;
fin>>a[0]; b[0]=1;
while(fin>>nr)
{ p=0; ok=0;
for(j=0;j<nb;j++)
{if(nr==a[j] && p==0)
{poz=j; p++; ok=1;}
else
if(nr==a[j])
{p++; ok=1;}
}
if(ok==1)
b[poz]=b[poz]+p;
else
{a[nb]=nr; b[nb]=1; nb++; }
}
for(i=0;i<nb;i++)
if(b[i]>max) max=b[i];
cout<<max<<endl<<endl;
if(max<k) cout<<nb<<"\n"<<"Da";
if(max>=k) cout<<max<<"\n"<<"Nu";
return 0;
}