Cod sursa(job #1093228)
| Utilizator | Data | 27 ianuarie 2014 20:30:43 | |
|---|---|---|---|
| Problema | Factorial | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.54 kb |
#include <iostream>
#include <fstream>
using namespace std;
int a[126];
int main()
{
int n = 0, p, contor, j = 0;
ifstream fin("fact.in");
fin>>p;
while(n/5 < p - 1)
n++;
for(int i=1; i<=n; i++)
if(i%5 == 0)
a[j++] = i;
contor = j;
for(int i=0; i<j; i++)
if(a[i]%25 == 0)
contor++;
if(contor*p == n)
n = -1;
if(contor*p < n)
n = n+5;
ofstream fout("fact.out");
fout<<n;
fout.close();
return 0;
}
