环球观察:CF 1651A - Playoff

Consider a playoff tournament where 2n athletes compete. The athletes are numbered from 1 to 2n.


(资料图片仅供参考)

The tournament is held in n

stages. In each stage, the athletes are split into pairs in such a way that each athlete belongs exactly to one pair. In each pair, the athletes compete against each other, and exactly one of them wins. The winner of each pair advances to the next stage, the athlete who was defeated gets eliminated from the tournament.

The pairs are formed as follows:

in the first stage, athlete 1 competes against athlete 2; 3 competes against 4; 5 competes against 6, and so on;

in the second stage, the winner of the match "1–2" competes against the winner of the match "3–4"; the winner of the match "5–6" competes against the winner of the match "7–8", and so on;

the next stages are held according to the same rules.

When athletes x and y compete, the winner is decided as follows:

if x+y is odd, the athlete with the lower index wins (i. e. if x<y, then x wins, otherwise y wins);

if x+y is even, the athlete with the higher index wins.The following picture describes the way the tournament with n=3 goes.

Your task is the following one: given the integer n, determine the index of the athlete who wins the tournament.

Input

The first line contains one integer t (1≤t≤30) — the number of test cases.

Each test case consists of one line containing one integer n (1≤n≤30).

Output

For each test case, print one integer — the index of the winner of the tournament.

Example

input

2

3

1

output

7

1

Note

The case n=3 is shown in the picture from the statement.

If n=1, then there's only one match between athletes 1 and 2. Since 1+2=3

is an odd number, the athlete with the lower index wins. So, the athlete 1 is the winner.

永远是2的n次方-1那个人最后获得胜利。

下面是代码:

标签:

x 广告
全球通讯!三安光电:6月21日融资买入7712.9万元,融资融券余额47.59亿元

6月21日,三安光电(600703)融资买入7712 9万元,融资偿还6784 05万元

天天快看:鲜于枢苏轼海棠诗卷_关于鲜于枢苏轼海棠诗卷简述

小伙伴们,你们好,今天小夏来聊聊一篇关于鲜于枢苏轼海棠诗卷,关于鲜

全球热议:品味端午的文化内涵(今日谈)

鼓声阵阵,挥桨激浪,龙舟队同江竞渡,引来岸边观众喝彩连连。端午节到

焦点资讯:网商贷怎么协商延期还款不管用怎么办?网商贷如何申请延期还款

网商贷怎么协商延期还款不管用怎么办1 再次联系网商贷客服:重新与

天天信息:蒙牛荣获“2023年度亚洲最佳管理团队” 六大奖项

6月21日蒙牛乳业2319HK在美国权威金融杂志《机构投资者》Institutional

鲜奶炖鸡汤_关于鲜奶炖鸡汤简述

小伙伴们,你们好,今天小夏来聊聊一篇关于鲜奶炖鸡汤,关于鲜奶炖鸡汤

当前讯息:创业板粤港澳公司哪家强(粤港澳上市企业市值排名)

创业板粤港澳公司哪家强(粤港澳上市企业市值排名),创业板粤港澳股票有

2023端午档票房破8000万

据猫眼专业版数据,2023年6月22日8时,2023年端午档(6月22日-6月24日

今日热闻!国外高校是如果建设EHS体系的?

环境、安全与健康体系(Environment,Health&Safety,简称为EHS)是20

浩云科技(300448)6月21日主力资金净卖出807.01万元_最新快讯

截至2023年6月21日收盘浩云科技300448报收于627元下跌442换手率366成交

x 广告

Copyright ©  2015-2023 亚洲都市网版权所有  备案号:京ICP备2021034106号-51   联系邮箱:5 516 538 @qq.com