10694 - Combinatorial Summation

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

Moderator: Board moderators

Larry
Guru
Posts: 647
Joined: Wed Jun 26, 2002 10:12 pm
Location: Hong Kong and New York City
Contact:

10694 - Combinatorial Summation

Post by Larry »

I didn't write the program yet, but I figured out the pattern. I think it's fascinating how and where fibonacci numbers keep popping up.. (and I guess noteworthy to remark!)
Larry
Guru
Posts: 647
Joined: Wed Jun 26, 2002 10:12 pm
Location: Hong Kong and New York City
Contact:

Post by Larry »

I've found that there are negative inputs (thanks, Manzoor!), is the answer just 0? I get WA.. grr.

for 1000, I get:

288924218456143360241882819981631900915673130543819759032778173440536722190488904520034507723846345056055096007885942673814977857042829762586259661446114504634668393210192357419233828310479227982326069668667250

Can someone check this, thanks.
abishek
Experienced poster
Posts: 131
Joined: Mon Dec 15, 2003 5:41 am

Post by abishek »

29792421850814336033688281998163190091567313054381975903277817344053672219048890 45200345081638463455390550965338859432428149784690428304175862603594461152456346 68393210192357419233828310479227982326069668667250


my AC program gives this
abishek
Experienced poster
Posts: 131
Joined: Mon Dec 15, 2003 5:41 am

Post by abishek »

and it is clearly given in the input that there will be an INTEGER (<999)
and so negative inputs are no suprise and I print a 0 as an answer for anything <1
so obviously there are zeros as well :D

the thanks to shariar manzoor is there in the problem statement itself. :D
really a nice question indeed
i liked it very much


bye
abi
Larry
Guru
Posts: 647
Joined: Wed Jun 26, 2002 10:12 pm
Location: Hong Kong and New York City
Contact:

Post by Larry »

Thanks, I corrected my error and got AC.
abishek
Experienced poster
Posts: 131
Joined: Mon Dec 15, 2003 5:41 am

Post by abishek »

congrats
shahriar_manzoor
System administrator & Problemsetter
Posts: 399
Joined: Sat Jan 12, 2002 2:00 am

Hmm

Post by shahriar_manzoor »

If the problem is nice all credits go to Mohammad Sajjad Hossain the problemsetter :D
abishek
Experienced poster
Posts: 131
Joined: Mon Dec 15, 2003 5:41 am

Post by abishek »

and the negative inputs were your idea is it? :D
shahriar_manzoor
System administrator & Problemsetter
Posts: 399
Joined: Sat Jan 12, 2002 2:00 am

hmm

Post by shahriar_manzoor »

abishek wrote:and the negative inputs were your idea is it? :D
NO! I am not the only bad person in this world. If u recall you will see than in the a^n+b^n=0 problem the alternate solution was written by "Md Sajjad Hossain" this very problem setter. And he had no objection :). So there are many people who like to give negative inputs...
little joey
Guru
Posts: 1080
Joined: Thu Dec 19, 2002 7:37 pm

Post by little joey »

Must be a Bengal thing, then :)

BTW
Meeting so many fine programmers from Bangladesh via the internet, makes you realise how small the distances between the different countries in the world have become in the recent deciennia.

Reading in the news about the terrible floodings that are going on in that country (and neighboring countries), and the many people dying in need of fresh drinking water and food, makes you realise how big the differences in the world still are...
Maniac
Experienced poster
Posts: 105
Joined: Tue Oct 14, 2003 3:24 pm
Location: Utrecht, Holland

Post by Maniac »

I must be missing something completely here, but could someone please help me out figuring out why the output for n=3 is 7?

- k C j in the picture means 'k choose j' as in k!/(j! (k-j)!) right?
- does 'sum k=n to minus infinity' mean: sum over k=n, k=n-1, k=n-2, etc..?

Cause if this is true then I don't see why the output of n=3 is finite: the terms coming from i=3, i=4, i=5, etc. all have the same positive contribution...

Any help would be welcome!
Larry
Guru
Posts: 647
Joined: Wed Jun 26, 2002 10:12 pm
Location: Hong Kong and New York City
Contact:

Post by Larry »

You should count any term as zero which has k < j.
Krzysztof Duleba
Guru
Posts: 584
Joined: Thu Jun 19, 2003 3:48 am
Location: Sanok, Poland
Contact:

Post by Krzysztof Duleba »

The way the first sum is written is misleading - usually it would mean all combinations of i and k such that 1 <= i <= oo, n >= k >= -oo. But here both variables are changing in the same time. In each iteration, i increases, but k decreases.

The sum looks like:
C(3,1) - first iteration
C(2,1) + C(2, 2) - second
C(1,1) - third
Since then, C = 0, and the final value is 3 + 2 + 1 + 1 = 7.
Maniac
Experienced poster
Posts: 105
Joined: Tue Oct 14, 2003 3:24 pm
Location: Utrecht, Holland

Post by Maniac »

ahhhh!!! OK, thanks, now I can start working on the problem.

That first sum is indeed misleading! I'm surprised to see so many people figured it out anyway...
Maniac
Experienced poster
Posts: 105
Joined: Tue Oct 14, 2003 3:24 pm
Location: Utrecht, Holland

Post by Maniac »

got AC now :-)
By the way, with this kind of problems I must say that integer-sequence-lookups on the internet are very tempting...
Post Reply

Return to “Volume 106 (10600-10699)”