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

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

11415 - Count the Factorials

Post by rajib_sust » Fri Aug 15, 2008 5:43 am

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

Post by rajib_sust » Fri Aug 15, 2008 10:08 pm

i am strange no one can give me any idea.

but i get now ACC.

thanks :o
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

Post by shakil » Fri Sep 19, 2008 9:11 pm

Why WA???

Code: Select all

Cut after AC
SHAKIL

User avatar
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

Post by Abednego » Tue Nov 18, 2008 11:34 am

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

Post by helloneo » Tue Nov 18, 2008 3:53 pm

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

Code: Select all

2703663
:-)

User avatar
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

Post by Abednego » Tue Nov 18, 2008 7:03 pm

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

Post by lazyboy » Mon Jan 26, 2009 9:03 pm

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

Post by MRH » Sun Feb 01, 2009 8:26 pm

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

Post by lazyboy » Tue Feb 03, 2009 9:12 pm

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

Post by MRH » Wed Feb 04, 2009 6:07 pm

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

Post by lazyboy » Wed Feb 04, 2009 8:24 pm

Thanks MRH.

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

Re: 11415 - Count the Factorials

Post by Ahmad » Sun Jul 10, 2011 4:07 am

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

Post Reply

Return to “Volume 114 (11400-11499)”