## 11415 - Count the Factorials

All about problems in Volume 114. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

rajib_sust
New poster
Posts: 16
Joined: Sun Mar 02, 2008 10:34 am
Location: SUST , Sylhet, Bangladesh

### 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
Location: SUST , Sylhet, Bangladesh

### 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
Location: CUET , bangladesh
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....
``````
Thanks in advance.
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

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

Thanks in advance.

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
thanks in advance

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

### Re: 11415 - Count the Factorials

Thanks MRH.

Ahmad
New poster
Posts: 16
Joined: Thu Apr 28, 2011 10:48 pm

### Re: 11415 - Count the Factorials

Hi,
to solve this problem u need a clever way to generate the number of factors of factorial -( solve the problem 884)-
for each number in the range 1 -> 10 000 000 ... maybe the Algorithm used in the problem 884 isn't enough for this problem.... but it will help you to of course.
then it's easy to find a way to pre-compute the desired results using dp. (Searching for each input will give TLE).
Ahmad