Cod sursa(job #24408)
Utilizator | Bugnaru Gelu gangstacorny | Data | 2 martie 2007 11:32:35 |
---|---|---|---|
Problema | Factorial | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.44 kb |
#include <fstream.h>
#define MAX 10001
ifstream fin("fact.in");
ofstream fout("fact.out");
int f[MAX];
int main()
{
int n, fact ;
fin >> n;
for ( int i = 2; i <= n; i ++)
{
int aux = i;
fact = 2;
while ( aux != 1 )
{
while ( aux % fact == 0 )
{
aux /= fact;
f[fact] ++;
}
fact ++;
}
}
for (i = 2; i <= 1000; i ++)
if ( f[i] )
fout << i ;
return 0;
}