Pagini recente » Cod sursa (job #3228914) | Cod sursa (job #2621243) | Cod sursa (job #2467072) | Cod sursa (job #1167914) | Cod sursa (job #147517)
Cod sursa(job #147517)
#include<fstream.h>
unsigned int v[1000],n,i,q,j,min,k=1,aux;
int main ()
{
ifstream f("economie.in");
ofstream g("economie.out");
f>>n;
for (i=0;i<n;i++)
f>>v[i];
for (i=0;i<n-1;i++)
for (j=i+1;j<n;j++) if (v[i]>v[j]) {aux=v[i];v[i]=v[j];v[j]=aux;}
for (i=k;i<n;i++) for (j=0;j<k-1;j++) if (v[i]%v[j]==0);
else for (q=j+1;q<k;q++) if (v[i]%v[j]+v[i]/v[j]==v[q]) ;
else k++;
g<<k+1;
for (i=0;i<k+1;i++) g<<'\n'<<v[i];
f.close();
g.close();
return 0;
}