CF1343A.Candies

入门

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Recently Vova found nn candy wrappers. He remembers that he bought xx candies during the first day, 2x2x candies during the second day, 4x4x candies during the third day, …\dots, 2k−1x2^{k-1} x candies during the kk-th day. But there is an issue: Vova remembers neither xx nor kk but he is sure that xx and kk are positive integers and k>1k \gt 1.

Vova will be satisfied if you tell him any positive integer xx so there is an integer k>1k \gt 1 that x+2x+4x+⋯+2k−1x=nx + 2x + 4x + \dots + 2^{k-1} x = n. It is guaranteed that at least one solution exists. Note that k>1k \gt 1.

You have to answer tt independent test cases.

最近,Vova 找到了 nn 张糖纸。他记得自己第一天买了 xx 颗糖,第二天买了 2x2x 颗糖,第三天买了 4x4x 颗糖,……,第 kk 天买了 2k−1x2^{k-1} x 颗糖。但这里有个问题:Vova 既不记得 xx 也不记得 kk,但他确信 xx 和 kk 均为正整数,且 k>1k \gt 1。

只要您能告诉 Vova 任意一个正整数 xx,使得存在某个整数 k>1k \gt 1 满足 x+2x+4x+⋯+2k−1x=nx + 2x + 4x + \dots + 2^{k-1} x = n,他就满意了。题目保证至少存在一个解。注意:k>1k \gt 1。

您需要回答 tt 个相互独立的测试用例。

输入格式

The first line of the input contains one integer tt (1≤t≤1041 \le t \le 10^4) — the number of test cases. Then tt test cases follow.

The only line of the test case contains one integer nn (3≤n≤1093 \le n \le 10^9) — the number of candy wrappers Vova found. It is guaranteed that there is some positive integer xx and integer k>1k \gt 1 that x+2x+4x+⋯+2k−1x=nx + 2x + 4x + \dots + 2^{k-1} x = n.

输入的第一行包含一个整数 tt(1≤t≤1041 \le t \le 10^4),表示测试用例的数量。随后是 tt 个测试用例。

每个测试用例仅一行,包含一个整数 nn(3≤n≤1093 \le n \le 10^9),表示沃瓦找到的糖果包装纸数量。题目保证存在某个正整数 xx 和整数 k>1k \gt 1,使得 x+2x+4x+⋯+2k−1x=nx + 2x + 4x + \dots + 2^{k-1} x = n。

输出格式

Print one integer — any positive integer value of xx so there is an integer k>1k \gt 1 that x+2x+4x+⋯+2k−1x=nx + 2x + 4x + \dots + 2^{k-1} x = n.

输出一个整数——任意满足条件的正整数 xx,使得存在整数 k>1k \gt 1,使得 x+2x+4x+⋯+2k−1x=nx + 2x + 4x + \dots + 2^{k-1} x = n。

输入输出样例

  • 输入#1

    7
    3
    6
    7
    21
    28
    999999999
    999999984

    输出#1

    1
    2
    1
    7
    4
    333333333
    333333328

说明/提示

In the first test case of the example, one of the possible answers is x=1,k=2x=1, k=2. Then 1⋅1+2⋅11 \cdot 1 + 2 \cdot 1 equals n=3n=3.

In the second test case of the example, one of the possible answers is x=2,k=2x=2, k=2. Then 1⋅2+2⋅21 \cdot 2 + 2 \cdot 2 equals n=6n=6.

In the third test case of the example, one of the possible answers is x=1,k=3x=1, k=3. Then 1⋅1+2⋅1+4⋅11 \cdot 1 + 2 \cdot 1 + 4 \cdot 1 equals n=7n=7.

In the fourth test case of the example, one of the possible answers is x=7,k=2x=7, k=2. Then 1⋅7+2⋅71 \cdot 7 + 2 \cdot 7 equals n=21n=21.

In the fifth test case of the example, one of the possible answers is x=4,k=3x=4, k=3. Then 1⋅4+2⋅4+4⋅41 \cdot 4 + 2 \cdot 4 + 4 \cdot 4 equals n=28n=28.

在示例的第一个测试用例中,一个可能的答案是 x=1,k=2x=1, k=2。此时 1⋅1+2⋅11 \cdot 1 + 2 \cdot 1 等于 n=3n=3。

在示例的第二个测试用例中,一个可能的答案是 x=2,k=2x=2, k=2。此时 1⋅2+2⋅21 \cdot 2 + 2 \cdot 2 等于 n=6n=6。

在示例的第三个测试用例中,一个可能的答案是 x=1,k=3x=1, k=3。此时 1⋅1+2⋅1+4⋅11 \cdot 1 + 2 \cdot 1 + 4 \cdot 1 等于 n=7n=7。

在示例的第四个测试用例中,一个可能的答案是 x=7,k=2x=7, k=2。此时 1⋅7+2⋅71 \cdot 7 + 2 \cdot 7 等于 n=21n=21。

在示例的第五个测试用例中,一个可能的答案是 x=4,k=3x=4, k=3。此时 1⋅4+2⋅4+4⋅41 \cdot 4 + 2 \cdot 4 + 4 \cdot 4 等于 n=28n=28。

输入解题思路,AI测评打分。不知道怎么写?

首页