1343 A candies Solution

  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. long n,k=1,x,i;
  6. int t;cin>>t;
  7. while(t--){
  8. cin>>n;
  9. for(i=0;i<=n;i++)
  10. {k=1+2*k;
  11. if(n%k==0){ x=n/k;cout<<x<<endl;k=1;break;}
  12.  
  13.  
  14. }
  15.  
  16. }
  17.  
  18. }

Comments

Popular posts from this blog

Codeforce Problem 1703A. YES or YES?

Aptitude test assistant programmer 2018

1041A. Heist solution