Cod sursa(job #1437373)
Utilizator | Data | 17 mai 2015 15:58:12 | |
---|---|---|---|
Problema | Factorial | Scor | 45 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.39 kb |
#include <iostream>
#include <fstream>
using namespace std;
int main(int argc, char** argv) {
ifstream f("fact.in");
ofstream g("fact.out");
int a,i = 0,count = 0,b;
f>>a;
while(count<a){
i = i + 5;
b = i/5;
while(b % 5 == 0 && b != 0){
count++;
b = b/5;
}
count++;
}
if(count > a) {
i = -1;
}
g<<i;
f.close();
g.close();
return 0;
}