codeforces Educational Codeforces Round 33 (Rated for Div. 2)B
来源:互联网 发布:任加踢法 知乎 编辑:程序博客网 时间:2024/06/05 07:19
mad 留下了 不细心看题 代码能力垃圾啊的眼泪 刚开始没看清题 写的很麻烦 之后没又加 等号 一直wa
#include<bits/stdc++.h>using namespace std;long long xxx(string x){ int a[10001]; for(int j=0;j<x.size();j++){ a[j]=x[j]-'0'; } long long l=0; long long i=x.size(); for(int j=0;j<x.size();j++){ l+=pow(2,i-j-1)*a[j]; } return l;}int main(){ int n; cin>>n; string a; int i=0; int b[10001]; for(int j=1;;j++){ for(int k=0;k<j;k++){ a=a+"1"; } for(int k=0;k<j-1;k++){ a=a+"0"; } b[j]=xxx(a); if(b[j]>10000000){ i=j; break; } a=""; } int x=0; for(int j=1;j<=i;j++){ if(b[j]<=n&&n%b[j]==0){ //这里忘记加了 x=b[j]; } else if(b[j]>n) break; } cout<<x<<endl; return 0;}
阅读全文
0 0
- codeforces Educational Codeforces Round 33 (Rated for Div. 2)B
- Educational Codeforces Round 33 (Rated for Div. 2) B
- codeforces Educational Codeforces Round 33 (Rated for Div. 2)
- Educational Codeforces Round 33 (Rated for Div. 2) C
- Educational Codeforces Round 33 (Rated for Div. 2)
- Educational Codeforces Round 33 (Rated for Div. 2)
- Educational Codeforces Round 33 (Rated for Div. 2) A
- Educational Codeforces Round 33 (Rated for Div. 2) C
- Educational Codeforces Round 33 (Rated for Div. 2)
- Educational Codeforces Round 33 (Rated for Div. 2) 题解
- Educational Codeforces Round 33 (Rated for Div. 2) F
- Educational Codeforces Round 33 (Rated for Div. 2) 893B. Beautiful Divisors
- Educational Codeforces Round 34 (Rated for Div. 2) D
- Educational Codeforces Round 34 (Rated for Div. 2)
- Educational Codeforces Round 34 (Rated for Div. 2) D
- Educational Codeforces Round 34 (Rated for Div. 2) D
- Educational Codeforces Round 34 (Rated for Div. 2) C
- Educational Codeforces Round 34 (Rated for Div. 2) D
- 【3分钟带你学】TCP/IP三次握手和四次挥手
- linux 目录结构
- java网络编程之Netty第一个程序(四)
- (七)java并发编程synchronized+volatile(安全初始化模式实例)
- codeforces Educational Codeforces Round 33 (Rated for Div. 2)
- codeforces Educational Codeforces Round 33 (Rated for Div. 2)B
- (九)java并发编程--java.lang.TheadLocal
- iOS多线程 一一 多图下载程序
- nginx+tomcat+memcached (msm)实现 session同步复制
- TreeUtil 数据库菜单生成无限级树形结构
- Java笔记2
- 单层感知机及其代码实现
- Linux下lshw,lsscsi,lscpu,lsusb,lsblk硬件查看命令
- TCP与UDP的区别