Cod sursa(job #2559433)
Utilizator | Data | 27 februarie 2020 12:25:59 | |
---|---|---|---|
Problema | Factorial | Scor | 5 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.4 kb |
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
int n,x,y,f;
ifstream in("fact.in");
ofstream out("fact.out");
in>>n;
x=1;
f=1;
while(y<n)
{
f=f*f+1;
x++;
if(f%10==0)
{
y++;
}
if(f>=10)
{
f=f/10;
}
}
out<<x;
return 0;
}