Codeforces B. Beautiful Divisors 893B
A solution in c++
#include<bits/stdc++.h>
using namespace std;
/// Typedef
typedef long long int ll;
//Int data type
#define sc1(a) scanf("%d", &a)
#define sc2(a, b) scanf("%d %d", &a, &b)
#define sc3(a, b, c) scanf("%d %d %d", &a, &b, &c)
#define sc4(a, b, c, d) scanf("%d %d %d %d", &a, &b, &c, &d)
//Long Data type
#define scl1(a) scanf("%lld", &a)
#define scl2(a, b) scanf("%lld %lld", &a, &b)
#define scl3(a, b, c) scanf("%lld %lld %lld", &a, &b, &c)
#define scl4(a, b, c, d) scanf("%lld %lld %lld %lld", &a, &b, &c, &d)
int main(){
ll i=0,j=0,n,m,t,a,b,e,g,ck=0,ln;
ll arr[] = {1, 6, 28, 120, 496, 2016, 8128, 32640};
scl1(n);
for(i=7; i>=0; i--){
if(n%arr[i]==0)
printf("%d",arr[i]),exit(0);
}
}
0 Comments
If you have any doubts, Please let me know