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
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题的更多相关文章
- 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 ...
- 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 ...
- 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 ...
- 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) F. Subtree Minimum Query(主席树合并)
题意 给定一棵 \(n\) 个点的带点权树,以 \(1\) 为根, \(m\) 次询问,每次询问给出两个值 \(p, k\) ,求以下值: \(p\) 的子树中距离 \(p \le k\) 的所有点权 ...
- Educational Codeforces Round 33 (Rated for Div. 2) 题解
A.每个状态只有一种后续转移,判断每次转移是否都合法即可. #include <iostream> #include <cstdio> using namespace std; ...
- Educational Codeforces Round 33 (Rated for Div. 2)A-F
总的来说这套题还是很不错的,让我对主席树有了更深的了解 A:水题,模拟即可 #include<bits/stdc++.h> #define fi first #define se seco ...
- 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 ...
- 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 ...
随机推荐
- APM之原理篇
APM,应用性能监控,有new relic等产品,对APM感兴趣的应该不会不知道它了.主要功能就是统计分析应用的CPU.内存.网络.数据库.UI等性能,并提供错误日志捕获.编码人员需要做的仅仅是使用它 ...
- Android Studio彻底删除Module
在"Project"视图中选择需要删除的module名,此处删除"app",点击右键,选择"Open Module Setting",然后选 ...
- (十三)springMvc 处理 Json
目录 文章目录 为什么用 Json 处理 json 的流程 环境准备 配置 json 转换器 后记 更新 为什么用 Json Json 格式简单,语法简单,解析简单 : 处理 json 的流程 判断客 ...
- class CAdoInterface
AdoInterface.h #pragma once //#pragma warning (push) //以防会产生警告 C4018,但这个警告是没关系的,所以使用下一句代码屏蔽它 //#prag ...
- django的admin密码忘记了怎么办?一分钟解决!!
django-admin确实是在实际开发中很方便,然后项目开发一段时间放到一边,等你再去玩你当初的项目的时候,可能抱歉你的admin密码忘记了,其实解决办法有很多种,我直说最快的一种,直接重新建立一个 ...
- 6.Linux查看哪个进程占用磁盘IO
$ iotop -oP命令的含义:只显示有I/O行为的进程
- Reids 连环炮面试(转)
出处: <今天面试了吗>-Redis Redis是什么 面试官:你先来说下redis是什么吧 我:(这不就是总结下redis的定义和特点嘛)Redis是C语言开发的一个开源的(遵从BSD ...
- OPENCV运行的问题,自带的程序可以运行,但是自己制作的QT报错
在PC上跑没问题 qmake 交叉编译后出来的文件 将OPCV和QT的镜像挂载后,在板子上运行程序, 能够出来这个界面,一点击按钮,提示如下错误. . 然而,百度网盘下载的代码.跟上面一样的操作,在板 ...
- CentOS7安装配置redis5集群
一.服务器准备 本文准备了3台服务器 , 分别是 172.18.0.231 172.18.0.232 172.18.0.233 每台运行2个redis实例, 端口分别为7000 7001 ,即总共6个 ...
- C++反汇编第五讲,认识C++中的Try catch语法,以及在反汇编中还原
我们以前讲SEH异常处理的时候已经说过了,C++中的Try catch语法只不过是对SEH做了一个封装. 如果不懂SEH异常处理,请点击博客链接熟悉一下,当然如果不想知道,也可以直接往下看.因为异常处 ...