Cod sursa(job #1418547)
Utilizator | Data | 13 aprilie 2015 14:05:52 | |
---|---|---|---|
Problema | Factorial | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.35 kb |
#include <fstream>
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
long long P;
int main()
{
int k=0;
f>>P;
f.close();
if (P%10 == 5) g<<-1<<'\n';
else if (P==0) g<<1<<'\n';
else
{for (int i = 1;i <= P; i++)
if (i%10!=5)
k+=5;
g<<k<<'\n';
}
}