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. 【AtCoder】AGC006

    AGC006 A - Prefix and Suffix -- #include <bits/stdc++.h> #define fi first #define se second #d ...

  2. MongoDB环境搭建

    MongoDB系列第一课:MongDB简介 MongoDB系列第二课:MongDB环境搭建 MongoDB系列第三课:MongDB用户管理 MongoDB系列第四课:MongoDB数据库.集合.文档的 ...

  3. 第八章 ZYNQ-MIZ701 软硬调试高级技巧

      软件和硬件的完美结合才是SOC的优势和长处,那么开发ZYNQ就需要掌握软件和硬件开发的调试技巧,这样才能同时分析软件或者硬件的运行情况,找到问题,最终解决.那么本章将通过一个简单的例子带大家使用v ...

  4. 记笔记的软件(vnote)

    前面我们已经把我们的 Ubuntu 系统在物理机上运行起来了,也做了一些简单的优化,教了大家怎么使用 Ubuntu 系统自带的应用商店和 apt 安装和卸载软件.接着我们安装了搜狗输入法,现在我们的系 ...

  5. 怎样写一个 "Hello, World!"

    第一步: 打开浏览器, 按 F12 键或 Ctrl + Shift + J.   注意:  1. 打开的这个界面是浏览器的开发者工具界面. 2. 顶部有许多Tab栏, 如: Elements / Co ...

  6. Django rest-framework框架-序列化

    序列化: 第一版: class RolesView(APIView): def get(self,request,*args,**kwargs): roles = models.Role.object ...

  7. get_object_or_404返回404(400)

    get_object_or_404:第一个参数为queryset,第二个参数必须以关键字的形式传递,否则报错

  8. 在Ubuntu中使用uwsgi 启动 Django ,但是静态文件映射出错

    错误 :  找不到/static/下面的静态文件 解决方法: 在uswgi.ini 文件中配置参数 static-map=/static=/home/wb/Desktop/test_django/st ...

  9. 9.EL表达式 和 JSTL核心标签库

    EL表达式 1./*获取数据*/ (某个web域中的对象,访问javabean的属性.访问List集合.访问Map集合.访问数组) <html> <head> <titl ...

  10. Linux磁盘的管理

    文件系统 磁盘必须要有文件系统---数据库 文件系统是用来数据存储,数据库是用来管理数据 windows fat32  ntfs   exfat linux  单文件系统 inode--索引空间(文件 ...