Page 1 of 4

10213 - How Many Pieces of Land ?

Posted: Wed Jan 16, 2002 9:49 am
by chang
Hey !
Pls inform what'll be the output for the following values of N ?
N=5,6,7,8,9,10,2147483647

Thanks in advanve.

Posted: Wed Jan 16, 2002 5:33 pm
by Even
5 16
6 31
7 57
8 99
9 163
10 256
2^31-1 886151993063477126682488902248300547

and use BIG NUM...
I got WA even use long double...

Posted: Sat Jan 19, 2002 9:20 pm
by chang
Hey Even!

Thanks for ur reply.
Oh! my recurrence was wrong. But I can't detect how the recurrence can be built. Would u please inform how built up ur recurrence,Or is there any direct formula to solve this one?
Thanks in advance.

Posted: Sun Jan 20, 2002 8:54 am
by ..
Hi~

There is a formula to solve this question, I don't know if it has a name, because I prove it myself by induction:

answer = (i - 1) * i * (i * i - 5 * i + 18) / 24 + 1
where i is the input (For i > 1)


<font size=-1>[ This Message was edited by: .. on 2002-01-20 07:55 ]</font>

Posted: Sun Jan 20, 2002 8:46 pm
by chang
Hey ..

Would u pls tell how u derive that formula by induction procedure? I'm really so curious to know it. I've the idea of induction, but I can't find out the way of thinking.
Thanks in advance.

Posted: Mon Jan 21, 2002 8:16 am
by ..
oh......that is quite difficult to tell you the proof by text......hope you will understand what I say:

Let P(n) be the number of lands when n points are drawn on circle

Now assume knowing P(n-1), want to know P(n) by adding the n-th point

when the n-th point draw a line to the k-th point (1 <= k <= n-1)
on the LHS on k-th point, there is k-1 points between k-th and n-th point
on the RHS on k-th point, there is (n-1)-k+1 points between k-th and n-th point
the points in these 2 sets(LHS, RHS) are completely connected,
so there are (k-1)*(n-k) lines crossed by the newly drawn line,
creating (k-1)*(n-k)+1 new lands......

So, drawing lines from newly added n-th point to all n-1 old points,
will create

summation[(k-1)(j-k)+1] {k = 1..j (j = n-1)} new lands

let says the summation be F(j)

P(n)= P(n-1) + F(n-1)
= P(n-2) + F(n-2) + F(n-1)
.....
= P(0) + F(1) + F(2) + ....... + F(n-1)
= 1 + summation(F(i)) {i = 1..n-1}


by using formula of summation to simplify the equatoin(what a difficult job.....)
I get
answer = (i - 1) * i * (i * i - 5 * i + 18) / 24 + 1;

Good luck~

Posted: Wed Nov 06, 2002 5:14 pm
by zhangl
answer=c(n,4)+c(n,2)+1

10213 - How many pieces of land?

Posted: Wed Jun 11, 2003 2:03 am
by jpfarias
Hi all!

I was thinking in this problem and don't get the recurrence relation...

Can anyone help?

Thanks,

JP!

Posted: Wed Jun 11, 2003 5:55 am
by Dmytro Chernysh
Or yes... this one is very hard. I just can give an answer
answer = (n - 1) * n * (n * n - 5 * n + 18) / 24 + 1
please, take a look at the previous posts...

And how do I get it?

Posted: Wed Jun 11, 2003 1:58 pm
by jpfarias
Ok, it appears to be right!

But, how do I get to this formula?

Thanks!


PS: I searched the board and did not found any topic on this problem, can you tell me where it is?

Posted: Wed Jun 11, 2003 2:34 pm
by Dominik Michniewski
topics are divided into pages ... on top of table with list of them you see some numbers like 1,2,3 .... and so on ....

Try to click on it and you got next page of forum for such vlume

Bet regards
DM

I've found it!

Posted: Wed Jun 11, 2003 5:57 pm
by jpfarias
Sorry, I've found it now!!! :oops:

My search was using the board search feature, on 10213, and it did not return that topic...

Looking page by page, I've found it, is there a bug in the search engine?

Again, sorry for my fault..

JP!

Posted: Thu Jun 12, 2003 7:49 am
by Dominik Michniewski
No problem. Life is sometimes hard ;)

DM

Posted: Thu Jun 12, 2003 10:03 am
by Alexander Denisjuk
By the way, it is not very hard to obtain the formula. The easiest way is the following:

1. To beleive that the formula is polynomial.
2. To calculate the interpolation polynomail.

:)

10213 how to solve?!?

Posted: Thu Oct 23, 2003 9:40 pm
by chervensky
huh
for k points
is it the answer something like 2^k
can you suggest some recurrence relation

thanks!

nick