You are on page 1of 2

#include <iostream>

#include <fstream>
#include <cstring>

using std::cin;
using std::cout;
using std::endl;

std::ifstream f("atestat.in");
std::ofstream g("atestat.out");

#define log(x) cout<<x;

int main()
{
int n, x, minn, poz=1, poz_minn, a, b;
bool ok = true, gasit = false;
f >> n;
while (n)
{
f >> x;
if (poz == 1)
a = x;
if (poz == 2)
b = x;
if (x % 2 == 1)
{
gasit = true;
if (ok == true)
{
minn = x;
poz_minn = poz;
ok = false;
}
if (x < minn and ok == false)
{
minn = x;
poz_minn = poz;
}
}
poz++;
n--;
}
if (gasit == true)
{
g << minn << " " << poz_minn << endl;
if (a < b)
{
int aux = a;
a = b;
b = aux;
}
while (b != 0)
{
int r = a % b;
a = b;
b = r;
}
g << a;
}
else
g << "NU EXISTA";
return 0;
}

You might also like