Logo
(追記) (追記ここまで)

23555번 - Gaokao 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 (추가 시간 없음) 256 MB60353159.615%

문제

Roundgod is about to attend Gaokao (National Unified Examination for Admissions to General Universities and Colleges) and his dream school is Zhejiang University. He sees an interesting problem while he is studying Math, which is a problem related to Pascal's Triangle.

The definition of Pascal's Triangle is given below:

The first element and the last element of each row in Pascal's Triangle is 1ドル,ドル and the $m_{th}$ element of the $n_{th}$ row equals to the sum of the $m_{th}$ and the ($m-1$)$_{th}$ element of the ($n-1$)$_{th}$ row. Here's an example of a 5 levels Pascal's Triangle .

$1ドル$$ $1ドル\quad 1$$ $1ドル \quad2\quad 1$$ $1ドル \quad3 \quad3\quad 1$$ $1ドル \quad4\quad 6\quad 4 \quad1$$

In the task, Roundgod is required to calculate how many elements in the 126ドル_{th}$ row of Pascal's Triangle are odd numbers.

After solving it, Roundgod thinks of a harder version of this problem. He gives you many requests about similar questions but the row number will be bigger. Please calculate that how many elements in the $k_{th}$ row of Pascal's Triangle are odd numbers.

입력

There are multiple test cases. The first line of the input contains an integer $T$ (1ドル \le T \le 500$), indicating the number of test cases. For each test case:

The first and only line contains an integer $K$$(K\leq 10^{18}),ドル indicating the required row number in Pascal's Triangle.

출력

For each test case, output the number of odd numbers in the $k_{th}$ line.

제한

예제 입력 1

3
3
4
5

예제 출력 1

2
4
2

힌트

출처

Contest > Open Cup > 2019/2020 Season > Stage 17: Grand Prix of Nanjing (by Legilimens+Coffee Chicken) J번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /