Cod sursa(job #1665977)
Utilizator | Data | 27 martie 2016 15:40:20 | |
---|---|---|---|
Problema | Factorial | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.44 kb |
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ifstream f("fact.in");
ofstream g("fact.out");
long int p;
f >> p;
long int n = 0;
long int db = 0;
long int s = 1;
while (db<p) {
n++;
s = s * n;
while(s%10==0) {
s = s/10;
db++;
}
s = s%10;
}
g << n;
return 0;
}