Cod sursa(job #240928)
Utilizator | Data | 8 ianuarie 2009 21:56:27 | |
---|---|---|---|
Problema | Factorial | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.32 kb |
#include<iostream.h>
#include<fstream.h>
ifstream in("fact.in");
ofstream out("fact.out");
int main()
{
int p,ok=0,n,twos=0,fives=0;
in>>p;
for(n=1;ok==0;n++)
{
if(n%2==0) twos++;
if(n%5==0) fives++;
if(twos>=p && fives>=p) ok=n;
}
out<<ok<<endl;
out.close();
in.close();
return 0;
}