Cod sursa(job #765659)
| Utilizator | Data | 8 iulie 2012 19:06:26 | |
|---|---|---|---|
| Problema | Factorial | Scor | 10 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.44 kb |
#include <iostream>
#include <fstream>
using namespace std;
int n,nr;
bool sepoate;
void eposibil(int n)
{
int k=1;
while(6*k-1<n) {k++; nr++;}
if(6*k-1==n) sepoate=false;
else sepoate=true;
}
int main()
{
ifstream in("fact.in");
ofstream out("fact.out");
in>>n;
if(n==0) out<<1;
else{
eposibil(n);
if(sepoate==true)
out<<5*(n-nr);
else out<<0;
}
return 0;
}
