codeforces Educational Codeforces Round 33 (Rated for Div. 2)B
#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;
}
相關文章
- codeforces Educational Codeforces Round 33 (Rated for Div. 2)
- Educational Codeforces Round 33 (Rated for Div. 2) C
- Educational Codeforces Round 37 (Rated for Div. 2)
- Educational Codeforces Round 93 (Rated for Div. 2)
- Educational Codeforces Round 170 (Rated for Div. 2)
- Educational Codeforces Round 100 (Rated for Div. 2)
- Educational Codeforces Round 34 (Rated for Div. 2) D
- Educational Codeforces Round 163 (Rated for Div. 2)
- Educational Codeforces Round 154 (Rated for Div. 2)
- Educational Codeforces Round 168 (Rated for Div. 2)
- Educational Codeforces Round 93 (Rated for Div. 2)題解
- Educational Codeforces Round 170 (Rated for Div. 2) A-D
- Educational Codeforces Round 170 (Rated for Div. 2) ABCD
- Educational Codeforces Round 171 (Rated for Div. 2) 題解
- Educational Codeforces Round 168 (Rated for Div. 2) A - E
- 【CodeForces訓練記錄】Educational Codeforces Round 171 (Rated for Div. 2)
- Educational Codeforces Round 143 (Rated for Div. 2) A-E
- Educational Codeforces Round 142 (Rated for Div. 2) A-D
- vp Educational Codeforces Round 168 (Rated for Div. 2) A - E
- Educational Codeforces Round 168 (Rated for Div. 2) 題解
- Educational Codeforces Round 95 (Rated for Div. 2) G. Three Occurrences
- Educational Codeforces Round 163 (Rated for Div. 2) - VP記錄
- Educational Codeforces Round 166 (Rated for Div. 2) - VP記錄
- Educational Codeforces Round 162 (Rated for Div. 2) - VP記錄
- Educational Codeforces Round 159 (Rated for Div. 2) - VP記錄
- Educational Codeforces Round 158 (Rated for Div. 2) - VP記錄
- Educational Codeforces Round 99 (Rated for Div. 2)D. Sequence and Swaps
- Educational Codeforces Round 167 (Rated for Div. 2) D(dp,貪心)
- Educational Codeforces Round 163 (Rated for Div. 2) 補題記錄(A~A)
- Educational Codeforces Round 171 (Div. 2)
- Codeforces Round #336 (Div. 2) B 暴力
- Educational Codeforces Round 98 (Rated for Div. 2) E. Two Editorials 細節題
- Educational Codeforces Round 99 (Rated for Div. 2) D. Sequence and Swaps(貪心)
- [CF1954] Educational Codeforces Round 164 (Rated for Div. 2) 題解
- Playrix Codescapes Cup (Codeforces Round #413, rated, Div. 1 + Div. 2) B
- Codeforces Round #448 (Div. 2)B
- Codeforces Round #450 (Div. 2) B
- Educational Codeforces Round 165 (Rated for Div. 2) C. Minimizing the Sum題解