#P17189. [ICPC 2017 Hong Kong R] Count the Even Integers
[ICPC 2017 Hong Kong R] Count the Even Integers
Problem Description
Yang Hui’s Triangle is defined as follows.
In the first layer, there are two numbers and satisfying .
Then for each , the -th layer contains numbers satisfying and for .
$$\begin{matrix} 1 & 1 \\ 1 & 2 & 1 \\ 1 & 3 & 3 & 1 \\ 1 & 4 & 6 & 4 & 1 \\ 1 & 5 & 10 & 10 & 5 & 1 \\ 1 & 6 & 15 & 20 & 15 & 6 & 1 \\ 1 & 7 & 21 & 35 & 35 & 21 & 7 & 1 \\ 1 & 8 & 28 & 56 & 70 & 56 & 28 & 8 & 1 \end{matrix}$$Now, given an integer , you are asked to count the number of even integers in the first layers.
Input Format
The input file contains multiple cases, please handle it to the end of file.
For each case, there is only one line containing an integer ().
Output Format
For each case, output the number of the even integers in the first layers of Yang Hui’s Triangle.
4
8
12
4
16
42