|
How Many Pieces of Land ?
|
|
08-17-2009, 11:40 PM
(This post was last modified: 10-29-2009 09:26 PM by drdebcol.)
Post: #1
|
|||
|
|||
|
How Many Pieces of Land ?
You are given an elliptical-shaped land and you are asked to choose n arbitrary points on its boundary. Then you connect each point with every other point using straight lines, forming n(n − 1)/2 connections. What is the maximum number of pieces of land you will get by choosing the points on the boundary carefully?
Input The first line of the input file contains one integer s (0 < s < 3, 500), which indicates how many input instances there are. The next s lines describe s input instances, each consisting of exactly one integer n (0 ≤ n < 231). Output For each input instance output the maximum possible number pieces of land defined by n points, each printed on its own line. Sample Input 4 1 2 3 4 Sample Output 1 2 4 8 Solution Code: program how_many_pieces_of_land;"I dont know with what weapons World War 3 will be fought with, but i know World War 4 will be fought with stones and sticks" - Albert Einstein |
|||
|
08-17-2009, 11:52 PM
Post: #2
|
|||
|
|||
|
RE: How Many Pieces of Land ?
Sounds like an artificial intelligence problem. Will look at it tonight....G4143
|
|||
|
« Next Oldest | Next Newest »
|





