Page 1 of 2

10694 - Combinatorial Summation

Posted: Wed Aug 04, 2004 4:14 pm
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!)

Posted: Wed Aug 04, 2004 5:00 pm
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.

Posted: Wed Aug 04, 2004 8:50 pm
by abishek
29792421850814336033688281998163190091567313054381975903277817344053672219048890 45200345081638463455390550965338859432428149784690428304175862603594461152456346 68393210192357419233828310479227982326069668667250


my AC program gives this

Posted: Wed Aug 04, 2004 8:52 pm
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

Posted: Wed Aug 04, 2004 9:51 pm
by Larry
Thanks, I corrected my error and got AC.

Posted: Wed Aug 04, 2004 10:21 pm
by abishek
congrats

Hmm

Posted: Thu Aug 05, 2004 5:27 am
by shahriar_manzoor
If the problem is nice all credits go to Mohammad Sajjad Hossain the problemsetter :D

Posted: Thu Aug 05, 2004 10:30 am
by abishek
and the negative inputs were your idea is it? :D

hmm

Posted: Thu Aug 05, 2004 10:41 am
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...

Posted: Thu Aug 05, 2004 11:28 am
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...

Posted: Fri Aug 06, 2004 1:06 pm
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!

Posted: Fri Aug 06, 2004 3:00 pm
by Larry
You should count any term as zero which has k < j.

Posted: Fri Aug 06, 2004 3:03 pm
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.

Posted: Fri Aug 06, 2004 3:17 pm
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...

Posted: Fri Aug 06, 2004 4:24 pm
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...