Cod sursa(job #815095)

Utilizator DenisacheDenis Ehorovici Denisache Data 16 noiembrie 2012 16:48:08
Problema Factorial Scor 5
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");
int main()
{
    int N=0,P,i=0,x=0,y=0;
    f>>P;
    while (i<P)
    {
          N++;
          if (N%2==0) x++;
          if (N%5==0) y++;
          else if (N%10==0) y++;
          if (x>y) i=y;
          else i=x;
          }
    g<<N;
    return 0;
}