5.23 Vj A - Candies

#include<bits/stdc++.h>
#define ll long long
using namespace std;
//这道题不用考虑k等于几,根据公式得x=n/(1+2+4+...),只要得到整数x即可
int main()
{
    ll t,k,x,n;
    cin>>t;
    for(int i=0;i<t;i++)
    {
        cin>>n;
        ll j=1,s=1;
        while(j*=2)
        {
            s+=j;
            if(n%s==0)
            {
                cout<<n/s<<endl;
                break;
            }
        }
    }
}

猜你喜欢

转载自www.cnblogs.com/SyrupWRLD999/p/12941170.html
vj
今日推荐