Cod sursa(job #2087785)
| Utilizator | Data | 14 decembrie 2017 11:34:15 | |
|---|---|---|---|
| Problema | Factorial | Scor | 10 |
| Compilator | cpp | Status | done |
| Runda | bon | Marime | 0.44 kb |
#include <stdio.h>
#include <fstream>
#include <iostream>
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
int main()
{
int qwe=0,zxc;
unsigned p;
f>>p;
if (p==0){
g<<1;
}
else {
if ((p%6)==(5%6)){
g<<-1;
}
else{
zxc=p*5;
while (zxc/25!=0){
qwe+=1;
zxc/=25;
}
g<<(p-qwe)*5;
}
}
return 0;
}
