URAL 1083. Factorials!!!

 A simple math question, just scrab a simple answer:

#include  < cstdio >
#include 
< iostream >

using   namespace  std;

int  N  =   0 ;
int  K  =   0 ;

long   long  result  =   0 ;

void  main()
{
    scanf(
" %d " & N);

    getchar();

    
while ( ' ! '   ==  getchar())
    {
        
++ K;
    }

    
if (N  <=  K)
    {
        printf(
" %d " , N);
    }
else
    {
        
int  end  =  N % K;

        result 
=   1 ;

        
for (;N !=  end;N -= K)
        {
            result 
*=  N;
        }

        
if (end)
        {
            result
*=  end;
        }

        printf(
" %d " , result);
    }
}

你可能感兴趣的:(Ural,Problems)