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 ...
随机推荐
- JavaScript(js)笔记
js注释 JavaScript注释与Java注释相同 // 单行注释 /* 多行注释 */ js五大基本类型: number(数值型).string(字符串性).boolean(布尔型).unde ...
- 对Python中print函数参数的认识
输出函数是最常用的,对print()参数的准确认识尤为重要. sep='':sep参数表示函数中不同value的分隔符,默认为一个空格. end='':end参数表示函数结尾的处理,默认换行. 例如: ...
- Go的包管理工具(一)
在前面转载了系列文章:Golang 需要避免踩的 50 个坑,总得来说阅读量都挺大.今天这篇文章,咱们一起聊聊Go的依赖包管理工具. 背景 每一门语言都有其依赖的生态,当我们使用Java语言的时候,使 ...
- Linux上定时shell脚本
原文链接:http://www.92coder.com/9-Linux%E5%AE%9A%E6%97%B6shell%E8%84%9A%E6%9C%AC/#more 本文主要介绍在Linux系统上部署 ...
- 远程连接windows2003桌面无法使用剪切板的有效解决方法
远程桌面控制服务器时,无法剪切.粘贴一些东西,上网搜了一下,原来是rdpclip.exe(remote desktop clipboard)不起作用了.此程序负责管理本地机与远程服务器之间共享剪切板, ...
- ADO.NET连接数据库增删查改创建公用类
顺序如下:再web.config中添加数据库的用户名和密码 创建公用类. //添加进web.config中的账号和密码 /*<connectionStrings> <add name ...
- javaIO——PipedReader 和 PipedWriter 实现模拟即时聊天
上一篇学习了javaIO里面的 PipedReader 和 PipedWriter,这里对两个类做一个小小的练习:实现一个即时消息发送和接收的聊天系统(这里只实现单向发送,双向同理,定义两个管道即可) ...
- 【Caffe学习笔记】一 、环境安装 Caffe + cuda + windows10 + VS2015 安装笔记, win7也适用
1. 下载cuda8.0 cudnn5 anaconda https://developer.nvidia.com/cuda-80-ga2-download-archive https://de ...
- css的一些基础方法
1.css样式表分别有: 内联样式表 <!DOCTYPE html> <html lang="en"> <head> <meta char ...
- Error:Execution failed for task ':app:compileDebugJavaWithJavac'
百度一下呗 查找了各种解决方案,都不对症. 最后发现,造成这种异常的原因有很多.具体的还是要去终端编译,查看到底是什么地方出错了,然后具体问题具体分析. 终端进入项目的根目录,然后输入命令 ./gra ...