B. Beautiful Divisors

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 + 1 consecutive ones, and then k consecutive zeroes.

Some examples of beautiful numbers:

12 (110);
1102 (610);
11110002 (12010);
1111100002 (49610).
More formally, the number is beautiful iff there exists some positive integer k such that the number is equal to (2k - 1) * (2k - 1).

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

Input
The only line of input contains one number n (1 ≤ n ≤ 105) — the number Luba has got.

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

Input


Output


思路:看了看数据范围。QAQ,发现可以打表===水过

AC代码:

 #include<bits/stdc++.h>

 using namespace std;
int arr[]={,,, , ,, ,, ,};
int main(){
int n;
cin>>n;
for(int i=;i>=;i--){
if(arr[i]>n)
continue;
if(arr[i]==n){
printf("%d",n);return ;
}
if(n%arr[i]==){
cout<<arr[i];return ;
}
}
return ;
}

Educational Codeforces Round 33 (Rated for Div. 2) B题的更多相关文章

  1. Educational Codeforces Round 33 (Rated for Div. 2) D题 【贪心:前缀和+后缀最值好题】

    D. Credit Card Recenlty Luba got a credit card and started to use it. Let's consider n consecutive d ...

  2. Educational Codeforces Round 33 (Rated for Div. 2) C题·(并查集变式)

    C. Rumor Vova promised himself that he would never play computer games... But recently Firestorm — a ...

  3. Educational Codeforces Round 33 (Rated for Div. 2) A题

    A. Chess For Three Alex, Bob and Carl will soon participate in a team chess tournament. Since they a ...

  4. Educational Codeforces Round 33 (Rated for Div. 2) E. Counting Arrays

    题目链接 题意:给你两个数x,yx,yx,y,让你构造一些长为yyy的数列,让这个数列的累乘为xxx,输出方案数. 思路:考虑对xxx进行质因数分解,设某个质因子PiP_iPi​的的幂为kkk,则这个 ...

  5. Educational Codeforces Round 33 (Rated for Div. 2) F. Subtree Minimum Query(主席树合并)

    题意 给定一棵 \(n\) 个点的带点权树,以 \(1\) 为根, \(m\) 次询问,每次询问给出两个值 \(p, k\) ,求以下值: \(p\) 的子树中距离 \(p \le k\) 的所有点权 ...

  6. Educational Codeforces Round 33 (Rated for Div. 2) 题解

    A.每个状态只有一种后续转移,判断每次转移是否都合法即可. #include <iostream> #include <cstdio> using namespace std; ...

  7. Educational Codeforces Round 33 (Rated for Div. 2)A-F

    总的来说这套题还是很不错的,让我对主席树有了更深的了解 A:水题,模拟即可 #include<bits/stdc++.h> #define fi first #define se seco ...

  8. Educational Codeforces Round 33 (Rated for Div. 2) D. Credit Card

    D. Credit Card time limit per test 2 seconds memory limit per test 256 megabytes input standard inpu ...

  9. Educational Codeforces Round 33 (Rated for Div. 2) C. Rumor【并查集+贪心/维护集合最小值】

    C. Rumor time limit per test 2 seconds memory limit per test 256 megabytes input standard input outp ...

随机推荐

  1. C/C++快读(快速读入)有多——安全AC

    在一些算法题目中中,有的程序会被卡常(数),就是说,程序虽然渐进复杂度,(通俗来讲:算法的时间复杂度)可以接受,但因为算法本身的时间常数过大,导致程序在一些算法竞赛中超时.这是,快读就显得尤为重要了. ...

  2. 文件 open 方法

    文件对象方法: 文件对象方法  执行操作 f.close()    关闭文件 f.read([size=-1]) 从文件读取size个字符,当未给定size或给定负值的时候, 读取剩余的所有字符,然后 ...

  3. LeetCode 答案(python)1-17

    1.给定一个整数数组和一个目标值,找出数组中和为目标值的两个数. 你可以假设每个输入只对应一种答案,且同样的元素不能被重复利用. 示例: 给定 nums = [2, 7, 11, 15], targe ...

  4. OpsManager管理MongoDB

    mydb1 Ops Manager,mongodb,agent mydb2 mongodb,agent mydb3 mongodb,agent NUMA Settings sysctl -w vm.z ...

  5. mysql批量修改数据库表引擎

    数据库表之前的引擎是MyISAM,影响事务操作,要改成Innodb引擎 查询表引擎 SELECT CONCAT(table_name,' ', engine) FROM information_sch ...

  6. Cactus CodeForces - 231E (无向图缩环)

    大意: 给定无向图, 每个点最多属于一个简单环, 多组询问, 求给定起点终点, 有多少条简单路径. 先缩环, 然后假设两点树上路径经过$cnt$个环, 那么答案就为$2^{cnt}$. 要注意缩环建树 ...

  7. zepto学习(三)之详解

    zepto Zepto就是jQuery的移动端版本, 可以看做是一个轻量级的jQuery github地址: https://github.com/madrobby/zepto 官方地址: http: ...

  8. Lab1 Report

    Lab1 report A) The brief description that you install junit, hamcrest and eclemma. a)  install junit ...

  9. const成员函数和const对象

    从成员函数说起 在说const成员函数之前,先说一下普通成员函数,其实每个成员函数都有一个隐形的入参:T *const this. int getValue(T *const this) { retu ...

  10. 8. Object References, Mutability, and Recycling

    1. Variables Are Not Boxes # Think variables as sticky notes a = [1, 2, 3] b = a a.append(4) print b ...