Cod sursa(job #2326216)
| Utilizator | Data | 23 ianuarie 2019 13:24:28 | |
|---|---|---|---|
| Problema | Factorial | Scor | 10 |
| Compilator | cpp-64 | Status | done |
| Runda | simulare_preoli | Marime | 0.54 kb |
#include <fstream>
#include <iostream>
using namespace std;
ifstream in("fact.in");
ofstream out("fact.out");
int p;
long long cate(long long n)
{
long long a, b;
a = b = 0;
for(long long k = 1; k <= n; ++k)
{
if(!(k % 2))
++a;
if(!(k % 5))
++b;
}
return (a <= b ? a : b);
}
int main()
{
in >> p;
for(long long i = 1;; ++i)
{
if(cate(i) == p)
{
out << i;
return 0;
}
}
return 0;
}
