您的位置:首页 > 其它

Educational Codeforces Round 33 (Rated for Div. 2) B - Beautiful Divisors

2017-11-24 22:16 751 查看
枚举K

#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<cmath>
#include<set>
#include<queue>
#include<stack>
#include<map>
#define PI acos(-1.0)
#define in freopen("in.txt", "r", stdin)
#define out freopen("out.txt", "w", stdout)

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int maxn = 100 + 7, maxd = 670000 + 7;
const ll mod = 1e9 + 7;
const int INF = 0x7f7f7f7f;

int main() {
ios::sync_with_stdio(0);

int n;
cin >> n;
int ans = 1;
int a = 4, b = 2;
for(int k = 2; ; ++k) {
int t = (a-1) * (b);
if(t > n) break;
if(n % (t) == 0) ans = t;
a *= 2; b *= 2;
}
cout << ans << endl;

return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: