CF893B.Beautiful Divisors

普及/提高-

通过率:0%

AC君温馨提醒

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

题目描述

Recently Luba learned about a special kind of numbers that she calls beautiful numbers. The number is called beautiful iff its binary representation consists of k+1k+1 consecutive ones, and then kk consecutive zeroes.

Some examples of beautiful numbers:

  • 121_{2} ( 1101_{10} );
  • 1102110_{2} ( 6106_{10} );
  • 111100021111000_{2} ( 12010120_{10} );
  • 1111100002111110000_{2} ( 49610496_{10} ).

More formally, the number is beautiful iff there exists some positive integer kk such that the number is equal to (2k1)(2k1)(2^{k}-1)*(2^{k-1}) .

Luba has got an integer number nn , and she wants to find its greatest beautiful divisor. Help her to find it!

输入格式

The only line of input contains one number nn ( 1<=n<=1051<=n<=10^{5} ) — the number Luba has got.

输出格式

Output one number — the greatest beautiful divisor of Luba's number. It is obvious that the answer always exists.

输入输出样例

  • 输入#1

    3
    

    输出#1

    1
    
  • 输入#2

    992
    

    输出#2

    496
    
首页