Cod sursa(job #39665)
Utilizator | Data | 26 martie 2007 21:43:51 | |
---|---|---|---|
Problema | Iepuri | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.47 kb |
// Problema factorial
#include <stdio.h>
int main()
{
long p;
freopen( "fact.in" , "rt", stdin );
scanf( "%ld", &p );
fclose( stdin );
long s = 0;
while( p > 0 )
{
s++;
p--;
if( s%5 == 0 ) p -= s/5;
}
freopen( "fact.out", "wt", stdout );
if( s > 0 ) printf ( "%ld\n", 5*s );
else printf("1\n");
fclose( stdout );
return 0;
}