Cod sursa(job #1024070)
| Utilizator | Data | 8 noiembrie 2013 09:47:32 | |
|---|---|---|---|
| Problema | Factorial | Scor | 5 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.5 kb |
#include <fstream>
#include <bitset>
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
bitset <1000000001>a;
long long x,nr,i,p,putere;
int main()
{
f>>p;
for (i=5;i<=1000000000;i*=5)
a[i]=1;
putere=1;
nr=0;
while (nr<p)
{
x+=5;
if (a[x]==0)
nr++;
else
{
nr+=putere;
putere++;
}
}
g<<x;
f.close();
g.close();
}
