Cod sursa(job #1198551)
Utilizator | Data | 16 iunie 2014 09:55:34 | |
---|---|---|---|
Problema | Factorial | Scor | 15 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.33 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
int main()
{
long long p,x=0;
f>>p;
while(p>0){
if(x%5==0&&x){
p-=x/5+1;
}
else p--;
x++;
}
if(!p) g<<x*5;
else g<<-1;
return 0;
}