3127 - Area Calculation 3127 - Area Calculation 3127 - Area Calculation

Statistics Sub: 138 | AC: 41 | AC%: 29,71 | Score: 2,67
Created by Yaniel Alfredo Velázquez Bruceta
Added by jcfernandez (2015-02-25)
Limits
Total Time: 8000 MS | Test Time: 1000 MS |Memory: 61 MB | Output: 64 MB | Size: 14 KB
Enabled languages
Available in

Description

The sequence of shapes in the image displayed below is converging to the Sierpinski triangle, which is really an infinite collection of points and can be constructed by the following algorithm:
  1. The initial shape is a solid square.
  2. Shrink the current shape to half its dimensions (both height and width), and make two more copies of it (giving three copies total).
  3. Arrange the three copies so that each touches the two others as is shown in the below image. Set the current shape to be the union of these three.
  4. Repeat from step 2.
Here is an illustration of the first few iterations:



As the iterations go to infinity, this process creates an infinite number of connected points. However, consider the case of a finite number of iterations. If the initial square has a size of 3 units, what is the sum of perimeter of circumscribed circumferences of all (black) squares at a given iteration;jsessionid=D14492B66EB0A8093A6F1E9FB87A1E9D? Write a program to find out not the exact sum, but the number of decimal digits required to represent its integer portion. That is, find the number of decimal digits required to represent the largest integer that is at most as large as the sum of perimeter of circumscribed circumferences.
The sequence of shapes in the image displayed below is converging to the Sierpinski triangle, which is really an infinite collection of points and can be constructed by the following algorithm:
  1. The initial shape is a solid square.
  2. Shrink the current shape to half its dimensions (both height and width), and make two more copies of it (giving three copies total).
  3. Arrange the three copies so that each touches the two others as is shown in the below image. Set the current shape to be the union of these three.
  4. Repeat from step 2.
Here is an illustration of the first few iterations:



As the iterations go to infinity, this process creates an infinite number of connected points. However, consider the case of a finite number of iterations. If the initial square has a size of 3 units, what is the sum of perimeter of circumscribed circumferences of all (black) squares at a given iteration;jsessionid=D14492B66EB0A8093A6F1E9FB87A1E9D? Write a program to find out not the exact sum, but the number of decimal digits required to represent its integer portion. That is, find the number of decimal digits required to represent the largest integer that is at most as large as the sum of perimeter of circumscribed circumferences.
The sequence of shapes in the image displayed below is converging to the Sierpinski triangle, which is really an infinite collection of points and can be constructed by the following algorithm:
  1. The initial shape is a solid square.
  2. Shrink the current shape to half its dimensions (both height and width), and make two more copies of it (giving three copies total).
  3. Arrange the three copies so that each touches the two others as is shown in the below image. Set the current shape to be the union of these three.
  4. Repeat from step 2.
Here is an illustration of the first few iterations:



As the iterations go to infinity, this process creates an infinite number of connected points. However, consider the case of a finite number of iterations. If the initial square has a size of 3 units, what is the sum of perimeter of circumscribed circumferences of all (black) squares at a given iteration;jsessionid=D14492B66EB0A8093A6F1E9FB87A1E9D? Write a program to find out not the exact sum, but the number of decimal digits required to represent its integer portion. That is, find the number of decimal digits required to represent the largest integer that is at most as large as the sum of perimeter of circumscribed circumferences.

Input specification

Each test case is a line containing a non-negative integer 0 <= n <= 10 000 indicating the number of iterations.
Each test case is a line containing a non-negative integer 0 <= n <= 10 000 indicating the number of iterations.
Each test case is a line containing a non-negative integer 0 <= n <= 10 000 indicating the number of iterations.

Output specification

For each case, display the case number followed by the number of decimal digits required to represent the integer portion of the perimeter for the given number of iterations. Follow the format of the sample output.
For each case, display the case number followed by the number of decimal digits required to represent the integer portion of the perimeter for the given number of iterations. Follow the format of the sample output.
Each test case is a line containing a non-negative integer 0 <= n <= 10 000 indicating the number of iterations.

Sample input

5
0
5
11
25
1000

Sample output

Case 1: 2
Case 2: 3
Case 3: 4
Case 4: 6
Case 5: 178

Hint(s)

http://coj.uci.cu/24h/
http://coj.uci.cu/24h/
http://coj.uci.cu/24h/

Recommendation

We have carefully selected several similar problems: 2156 | 2243 | 2305 | 3479 | 1811 | 2141