Pagini recente » Cod sursa (job #594933) | Cod sursa (job #1820599)
#include <fstream>
using namespace std;
short v[1000];
fstream f("economie.in", ios::in), g("economie.out", ios::out);
int i, aux, Min, nr1=0;
short n;
int main()
{
f>>n;
for(i=0;i<n;i++)
f>>v[i];
for(i=0;i<n-1;i++)
if(v[i]>v[i+1])
{
aux=v[i];
v[i]=v[i+1];
v[i+1]=aux;
}
Min=v[0];
if(Min==1)
g<<Min<<"\n";
else
for(i=0;i<n;i++)
{
if(v[i+1]%Min==0)
continue;
else
{
nr=1;
Min=v[i+1];
}
}
for(i=0;i<n;i++)
if(Min==v[i])
nr1++;
g<<nr1<<"\n"<<Min;
return 0;
}