Codeforces 460D Little Victor and Set(看题解)
其他都很好求, 只有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 ;
} /*
*/
Codeforces 460D Little Victor and Set(看题解)的更多相关文章
- codeforces 460D Little Victor and Set(构造、枚举)
最近的CF几乎都没打,感觉挺水的一个题,不过自己仿佛状态不在,看题解才知道做法. 输入l, r, k (1 ≤ l ≤ r ≤ 1012; 1 ≤ k ≤ min(106, r - l + 1)). ...
- Codeforces 229E Gifts 概率dp (看题解)
Gifts 感觉题解写的就是坨不知道什么东西.. 看得这个题解. #include<bits/stdc++.h> #define LL long long #define LD long ...
- Codeforces 460D Little Victor and Set --分类讨论+构造
题意:从区间[L,R]中选取不多于k个数,使这些数异或和尽量小,输出最小异或和以及选取的那些数. 解法:分类讨论. 设选取k个数. 1. k=4的时候如果区间长度>=4且L是偶数,那么可以构造四 ...
- Codeforces 1155F Delivery Oligopoly dp(看题解)
看别人写的才学会的... 我们考虑刚开始的一个点, 然后我们枚举接上去的一条一条链, dp[mask]表示当前已经加进去点的状态是mask所需的最少边数. 反正就是很麻烦的一道题, 让我自己写我是写不 ...
- Codeforces 460D. Little Victor and Set
D. Little Victor and Set time limit per test:1 second memory limit per test:256 megabytes input:stan ...
- Codeforces 380D Sereja and Cinema (看题解)
Sereja and Cinema 首先我们可以发现除了第一个人, 其他人都会坐在已入坐人的旁边. 难点在于计算方案数.. 我们可以从外往里把确定的人用组合数算上去,然后缩小范围. #include& ...
- Codeforces 442D Adam and Tree dp (看题解)
Adam and Tree 感觉非常巧妙的一题.. 如果对于一个已经建立完成的树, 那么我们可以用dp[ i ]表示染完 i 这棵子树, 并给从fa[ i ] -> i的条边也染色的最少颜色数. ...
- Codeforces 915G Coprime Arrays 莫比乌斯反演 (看题解)
Coprime Arrays 啊,我感觉我更本不会莫比乌斯啊啊啊, 感觉每次都学不会, 我好菜啊. #include<bits/stdc++.h> #define LL long long ...
- Codeforces 1101F Trucks and Cities dp (看题解)
Trucks and Cities 一个很显然的做法就是二分然后对于每个车贪心取check, 这肯定会TLE, 感觉会给人一种贪心去写的误导... 感觉有这个误导之后很难往dp那个方向靠.. dp[ ...
随机推荐
- 如何创建带有大纲和书签的交互式web报表
交互式报表允许用户与之交互.例如,报表可以包含超链接.书签和大纲.通过点击大纲部分的标题,你可以将书签导航到报表中的所需位置.这样的报表经常用在产品目录中.(查看更多web报表教程) 让我们为Web创 ...
- 23. Spring Boot JPA BaseDao 配置 文章
参考文献:(早期JPA版本的描述) https://blog.csdn.net/yingxiake/article/details/51017797 https://www.jianshu.com/p ...
- 通过COM组件方式实现java调用C#写的DLL文件 转
最近一段时间单位在做一个Web项目,工程师用JAVA语言,需要公用人员信息,统一用户名和密码,原有的平台中是用C#语言开发的,在网上查找解决方法,通过JAVA调用C#的DLL文件实现.网上资料很多,自 ...
- Javaweb学习笔记——(三)——————JavaScript基础&DOM基础
day031.js的String对象 **创建String对象 ***var str = "abc"; **方法和属性(文档) ***属性 lenth:字符串的长度 ***方法 ( ...
- Nginx 日志处理
. nginx日志统计独立ip的个数: awk '{print $1}' /access.log | sort | uniq | wc -l . 查询访问最多的前10个ip awk . 查看某段时间的 ...
- Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=128m; support was removed in 8.0
1 启动hbase的时候爆出警告 Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=128m; suppor ...
- gtid_executed和gtid_purged变量是如何初始化的
一.官方释义 1.1.gtid_executed.gtid_purged https://dev.mysql.com/doc/refman/5.7/en/replication-options-gti ...
- Android Handler面试解析
- ubuntu “下列的软件包有不能满足的依赖关系” 问题
前阵子,刚安装Ubuntu时,安装vim的问题,现在些出来分享一下. apt-get install vim 正在读取软件包列表... 完成 正在分析软件包的依赖关系树 正在读取状态信息... 完成 ...
- 【逆向工具】逆向工具101editor使用-游戏快速通关
[渡者游戏简介] 船夫小江将运送客人的,羊.狐狸.草等物品过河,如果留下动物被其它种类吃掉任务就失败了.你需要帮助他做出正确的顺序选择.Ferryman是一款根据经典谜题改编的解谜游戏. 一.查看文件 ...