其他都很好求, 只有k == 3的时候很难受。。
我们找到第一个不大于l的 t, 答案为 l, 3 * t, (3 * t) ^ l
感觉好像是对的, 感觉又不会证明, 啊, 我好菜啊。
#include<bits/stdc++.h>
#define LL long long
#define fi first
#define se second
#define mk make_pair
#define PLL pair<LL, LL>
#define PLI pair<LL, int>
#define PII pair<int, int>
#define SZ(x) ((int)x.size())
#define ull unsigned long long using namespace std; const int N = 5e5 + ;
const int inf = 0x3f3f3f3f;
const LL INF = 0x3f3f3f3f3f3f3f3f;
const int mod = 1e9 + ;
const double eps = 1e-;
const double PI = acos(-); LL l, r, k; void print(LL x, int cnt) {
if(!cnt) return;
print(x / , cnt - );
printf("%d", x & );
} int main() {
scanf("%lld%lld%lld", &l, &r, &k);
LL n = r - l + ;
if(k == ) {
printf("%lld\n", l);
puts("");
printf("%lld\n", l);
} else if(k == ) {
if(n == ) {
if(l < (l ^ r)) {
printf("%lld\n", l);
puts("");
printf("%lld\n", l);
} else {
printf("%lld\n", l ^ r);
puts("");
printf("%lld %lld\n", l, r);
}
} else {
if(l & ) {
printf("%lld\n", (l + ) ^ (l + ));
puts("");
printf("%lld %lld\n", (l + ), (l + ));
} else {
printf("%lld\n", l ^ (l + ));
puts("");
printf("%lld %lld\n", l, (l + ));
}
}
} else if(k == ) {
LL t = ;
while(t * <= l) t *= ;
if(t * <= r) {
puts("");
puts("");
printf("%lld %lld %lld\n", l, * t, ( * t) ^ l);
} else {
puts("");
puts("");
if(l & ) printf("%lld %lld\n", l + , l + );
else printf("%lld %lld\n", l, l + );
}
} else {
if(l & ) {
if(n >= ) {
puts("");
puts("");
for(LL i = l + ; i < l + ; i++)
printf("%lld ", i);
puts("");
} else {
for(int S = ; S < ( << n); S++) {
vector<LL> vc;
LL val = ;
for(int i = ; i < n; i++)
if(S >> i & ) val ^= l + i, vc.push_back(l + i);
if(!val) {
puts("");
printf("%d\n", SZ(vc));
for(auto& t : vc) printf("%lld ", t);
puts("");
return ;
}
}
puts("");
puts("");
printf("%lld %lld\n", l + , l + );
}
} else {
puts("");
puts("");
for(LL i = l; i < l + ; i++)
printf("%lld ", i);
puts("");
}
}
return ;
} /*
*/