Educational Codeforces Round 33 (Rated for Div. 2) B题
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
3
Output
1
思路:看了看数据范围。QAQ,发现可以打表===水过
AC代码:
1 #include<bits/stdc++.h> 2 3 using namespace std; 4 int arr[]={1,6,28,120 ,496 ,2016, 8128,32640, 130816 ,523776}; 5 int main(){ 6 int n; 7 cin>>n; 8 for(int i=9;i>=0;i--){ 9 if(arr[i]>n) 10 continue; 11 if(arr[i]==n){ 12 printf("%d",n);return 0; 13 } 14 if(n%arr[i]==0){ 15 cout<<arr[i];return 0; 16 } 17 } 18 return 0; 19 }
转载于:https://www.cnblogs.com/pengge666/p/11511073.html
Educational Codeforces Round 33 (Rated for Div. 2) B题相关推荐
- Educational Codeforces Round 33 (Rated for Div. 2)C.Rumor并查集
Educational Codeforces Round 33 (Rated for Div. 2)C.Rumor并查集 题意:首先用并查集把N个人分成几块,然后每个块当中选取一个最小权值 加到答案中 ...
- Educational Codeforces Round 103 (Rated for Div. 2)前四题
Educational Codeforces Round 103 (Rated for Div. 2) 第二次被别人hack,悲 A - K-divisible Sum 题意 给定两个整数 n,kn, ...
- Educational Codeforces Round 33 (Rated for Div. 2) E. Counting Arrays
题目链接 题意:给你两个数x,yx,yx,y,让你构造一些长为yyy的数列,让这个数列的累乘为xxx,输出方案数. 思路:考虑对xxx进行质因数分解,设某个质因子PiP_iPi的的幂为kkk,则这个 ...
- Educational Codeforces Round 33 (Rated for Div. 2)
无奈只能打打虚赛... 一共写了4道题,但是d没在规定时间调出来. A. Chess For Three time limit per test 1 second memory limit per t ...
- Educational Codeforces Round 100 (Rated for Div. 2)补题记录
总结:感觉这个educational场好难啊(蒟蒻视角),又被虐了,唉 A. Dungeon 每一枪会造成1点伤害对一个单位,但是当开7的倍数枪时会造成3点伤害 每7次一个轮回,一个完整的轮回共造成9 ...
- Educational Codeforces Round 133 (Rated for Div. 2) D题
题目链接:Problem - D - Codeforces 一道非常经典的完全背包求方案数题: 首先先写好我们的状态转移方程,那什么代表体积,什么代表物品数目呢: 其实很清晰k, k + 1 ... ...
- codeforces Educational Codeforces Round 49 (Rated for Div. 2) C题
刚开始拿到这题很懵逼,知道了别人的思路之后开始写,但是还是遇到很多坑,要求求P2/S最大.p=a b.就是求(a2+ b2 +2ab)/ab最大,也就是a/b +b/a最大.那么题意就很明显了. 但是 ...
- Educational Codeforces Round 119 (Rated for Div. 2) 做题日志
A Equal or Not Equal 题意 给你一个字符串, s i = = E si == E si==E表示 a ( i ) = = a ( i + 1 ) a(i) == a(i+1) a( ...
- Educational Codeforces Round 131 (Rated for Div. 2)刷题记录OR题解
题解 A Grass Field 题面翻译 给出一个 2×22 \times 22×2 的矩阵,矩阵的值都是 000 和 111,定义一次操作:选择一个点,将其所在的行和列的点的值全部修改为 000, ...
最新文章
- 银行、航空软件结构图
- MongoDB 查询超时异常 SocketTimeoutException
- 进程通信之 Binder 机制浅析
- sql数据导入错误代码: 0x80004005_PL/SQL 非预定义异常、自定义异常处理、RAISE_APPLICATION_ERROR...
- 目标群体是什么意思_抖音代运营日常主要是做什么的?
- 基本存款账户编号怎么查_上海社会保障卡查询个人账户怎么查
- atitit.系统托盘图标的设计java swing c# .net c++ js
- lpddr3 阻抗_LPDDRx的总结
- android icon颜色转换工具,Android代码修改图标颜色
- 智能家居项目进度控制表
- Proxmox VE(PVE)+ceph+物理网络规划-超融合生产环境安装部署案例
- 数控自动编程软件比你想象的更方便!
- gitblit中忘记admin密码,怎么办?附详细解决方法和截图
- 罗辑思维八里庄沙龙:Cloud Native 的演进(—)--从零开始了解云原生架构
- 客厅与阳台之间的设计施工,要不要打通呢?
- shell编程(二)
- 机器学习100天(十七):017 逻辑回归梯度下降
- QGC地面站设置PX4无人机的电子围栏等安全模式
- 【LSTM回归预测】基于matlab LSTM神经网络回归预测【含Matlab源码 2227期】
- 微信开店需要营业执照吗?微信开店需要准备哪些资料?
热门文章
- 卢文军:中国制造业处中低端水平,需结合硬、软件作为支撑
- 闲暇而无聊的周末?让这六款游戏陪你度过吧
- php tab 键,微型计算机键盘上的Tab键是什么键?
- python怎么画正方体素描_python如何将图片转换素描画
- hashlib python_Python3之hashlib
- centos7/8使用yum/dnf安装java并设置环境变量
- ffmpeg给视频去背景声音和加音乐
- 三郎之——Java【多线程】
- 鸿蒙磅礴不可以涯际夕,五年级:《中华成语千字文》节选
- android中画布大小设置,如何设置canvas大小?