Cod sursa(job #663699)
Utilizator | Data | 18 ianuarie 2012 20:44:33 | |
---|---|---|---|
Problema | Factorial | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.39 kb |
#include <math.h>
#include <stdint.h>
#include <fstream>
using namespace std;
int main()
{
ifstream f("fact.in");
ofstream g("fact.out");
uint64_t n=1,m=1,p,x=1,z=1,i;
f>>p;
for (i=1;i<=p;i++)
{
z=z*10;
}
while(x==1)
{
if(m>z*10*10)
{
m=m%(z*10*10);
}
m=m*n;
if(m%z==0)
{
g<<n;
x=0;
}
n++;
}
}