Cod sursa(job #369854)
Utilizator | Data | 29 noiembrie 2009 17:43:12 | |
---|---|---|---|
Problema | Factorial | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.36 kb |
#include <iostream>
int main()
{
int a ;
std::cin>>a;
int i = 1, g;
g = 0;
while (g < a)
{
if (i != 0 && i % 25 == 0)
{
g = g + 2;
goto label;
}
if (i != 0 && i % 125 == 0)
{
g = g + 3;
goto label;
}
if (i % 5 == 0)
g = g + 1;
label:
if (g + 1 == a)
a--;
else
i++;
}
if ((i-1) % 5 != 0)
std::cout<<"-1";
else
std::cout<<i-1;
return 0;
}