Mai intai trebuie sa te autentifici.
Cod sursa(job #2200246)
| Utilizator | Data | 30 aprilie 2018 18:17:28 | |
|---|---|---|---|
| Problema | Factorial | Scor | 10 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.54 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream is("fact.in");
ofstream os("fact.out");
int P;
int check = 0;
int cutz(int s);
int main()
{
is >> P;
int rez = 1;
int N = 0;
while(check < P)
{
N++;
rez = rez * N;
rez = cutz(rez);
}
os << N;
is.close();
os.close();
return 0;
}
int cutz(int s)
{
if(s > 10000)
s = s % 10000;
if(s % 10 == 0)
{
check = check + 1;
s = s / 10;
}
return s;
}
