## 11415 - Count the Factorials

Moderator: Board moderators

rajib_sust
New poster
Posts: 16
Joined: Sun Mar 02, 2008 10:34 am

### 11415 - Count the Factorials

I am continuous getting TLE!!
any one can give me good algo i can not found a faster algo
my algo
1. generate prime factor
2. linear search and count

if any good idea?

thanks

nikson
life is beautiful like coding

rajib_sust
New poster
Posts: 16
Joined: Sun Mar 02, 2008 10:34 am

### 11415

i am strange no one can give me any idea.

but i get now ACC.

thanks
life is beautiful like coding

shakil
Learning poster
Posts: 74
Joined: Sat Jul 15, 2006 6:28 am
Contact:

### Re: 11415 - Count the Factorials

Why WA???

Code: Select all

``````Cut after AC
``````
SHAKIL

Abednego
A great helper
Posts: 281
Joined: Tue Sep 10, 2002 5:14 am
Location: Mountain View, CA, USA
Contact:

### Re: 11415 - Count the Factorials

What is the answer for n = 10000000? My WA program prints 3203899.
If only I had as much free time as I did in college...

helloneo
Guru
Posts: 516
Joined: Mon Jul 04, 2005 6:30 am
Location: Seoul, Korea

### Re: 11415 - Count the Factorials

Abednego wrote:What is the answer for n = 10000000? My WA program prints 3203899.
My AC code gives

Code: Select all

``2703663``

Abednego
A great helper
Posts: 281
Joined: Tue Sep 10, 2002 5:14 am
Location: Mountain View, CA, USA
Contact:

### Re: 11415 - Count the Factorials

Thanks, helloneo.
I'm confused though. Does anyone understand what the problem statement means by "1 is a prime". When do we count 1? How many times do we count 1?

Edit: Nevermind. I'm dumb. Fixed.
If only I had as much free time as I did in college...

lazyboy
New poster
Posts: 17
Joined: Tue Jul 08, 2008 3:19 am

### Re: 11415 - Count the Factorials

I am getting TLE in this problem. please anybody help me...
here is my code :

Code: Select all

``````removed....
``````
Last edited by lazyboy on Sat Oct 03, 2009 12:50 am, edited 1 time in total.

MRH
Learning poster
Posts: 51
Joined: Mon Aug 11, 2008 9:09 pm

### Re: 11415 - Count the Factorials

your sieve & process funtion take more time
think modified sive

lazyboy
New poster
Posts: 17
Joined: Tue Jul 08, 2008 3:19 am

### Re: 11415 - Count the Factorials

i am just modifying the sieve. but how can i make the process function more fast. please give me a little hints.

MRH
Learning poster
Posts: 51
Joined: Mon Aug 11, 2008 9:09 pm

### Re: 11415 - Count the Factorials

HI "lazyboy"
modified sive means your process funtion no need
this task can possible with sive

I hope now u can get ACC
it is enough hints

lazyboy
New poster
Posts: 17
Joined: Tue Jul 08, 2008 3:19 am

Thanks MRH.