عالم الحاسوب
26 - 02 - 2009, 15:38
مساء / صباح الورد
عندي عنا سؤال .. هذا السؤال كان من ضمن اسئلة مسابقة ACM للعام 2007 .. عن نفسي بعدني ما كملت الحل :ee: .. و كل واحد يشاركنا بفكره أو بالحل النهائي اذا وصل له
Description
We want to build the tallest skyscraper possible on our lot. We need to satisfy the following requirements:
* Each floor's area must be a whole number.
* The bottom floor has to fit on our lot.
* Each floor's area will be less than or equal to 4/5 of the area of the floor below it.
Given the lot size determine the maximum number of floors we can have in our skyscraper.
Input
Each line gives the area of a lot. It will be between 1.0 and 100,000.0
Output
Output the problem number and the maximum number of floors using the format shown below. The end of input will be signaled by a line containing -1.0
========== Example ==========
The first building can have its bottom floor area be 3 which can support a floor with an area of 2 which can support a floor with an area of 1. So the first building can have at most 3 floors.
Example Input
3.2
17321.2
-1.0
Example Output
Problem 1: 3
Problem 2: 40
السؤال فكرته بسيطه :mt:
تحياتي .. عالم الحاسوب
عندي عنا سؤال .. هذا السؤال كان من ضمن اسئلة مسابقة ACM للعام 2007 .. عن نفسي بعدني ما كملت الحل :ee: .. و كل واحد يشاركنا بفكره أو بالحل النهائي اذا وصل له
Description
We want to build the tallest skyscraper possible on our lot. We need to satisfy the following requirements:
* Each floor's area must be a whole number.
* The bottom floor has to fit on our lot.
* Each floor's area will be less than or equal to 4/5 of the area of the floor below it.
Given the lot size determine the maximum number of floors we can have in our skyscraper.
Input
Each line gives the area of a lot. It will be between 1.0 and 100,000.0
Output
Output the problem number and the maximum number of floors using the format shown below. The end of input will be signaled by a line containing -1.0
========== Example ==========
The first building can have its bottom floor area be 3 which can support a floor with an area of 2 which can support a floor with an area of 1. So the first building can have at most 3 floors.
Example Input
3.2
17321.2
-1.0
Example Output
Problem 1: 3
Problem 2: 40
السؤال فكرته بسيطه :mt:
تحياتي .. عالم الحاسوب