![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
2016个人训练赛7
文章平均质量分 62
金金金金鑫
这个作者很懒,什么都没留下…
展开
-
Codeforces 469B Chat Online
题意: 给你p个[a,b]的区间和q个[c,d]的区间,现给出区间[l,r]问你区间内有多少个整数t满足至少有一个[c+t,d+t]的区间与[a,b]区间有交集。 思路: 由于这里l,r,a,b,c,d都小于1000,那么可以直接标记[a,b]区间,然后枚举t,去判断[c+t,d+t]区间内是否有标记,若有这这个t满足。 #include #include #include using n原创 2016-07-22 21:15:00 · 267 阅读 · 0 评论 -
Codeforces 468A 24 Game
题意: 给你n,问你能否通过n-1次加、减、乘得到24,参与计算的数字计算完后退出能使用的数的集合,得到的数加入能使用的数的集合,初始集合内包含1~n的数各1个。 思路: 明显构造。因为一开始只有n个数,要进行n-1次计算,每次计算必定消耗2个数得到1个数,即n-1次计算完后,能使用的数只剩下1个,也就是24。那么说明我们必须使用每次计算完得到的那个数。有以下几种情况: 当n 当n==4原创 2016-07-22 21:16:05 · 220 阅读 · 0 评论 -
Codeforces 469A I Wanna Be the Guy
题意: 给你n,p个1~n之间的数,q个1~n之间的数,问你1~n之间的数是否都出现过。 思路: 对输入得数标记下,然后枚举1~n之间的数看是否有没有标记过的。 #include #include const int MAX=105; bool vis[MAX]; int main(){ int n,p,q,a; scanf("%d",&n); memset(vis,false,原创 2016-07-22 21:09:30 · 366 阅读 · 0 评论 -
Codeforces 465A inc ARG
题意: 给你n位的二进制数,从低位到高位。现在在低位上加1问你改变了多少位。 思路: 直接从低位开始枚举到0停止,因为遇到1肯定产生进位。 #include const int MAX=105; char s[MAX]; int n; int main(){ scanf("%d",&n); scanf("%s",s); int i; for(i=0;i<n;i++){ if原创 2016-07-22 21:30:29 · 236 阅读 · 0 评论 -
Codeforces 465B Inbox (100500)
题意: 给你n个0,1的数,1表示有信未读。现给出一些操作,问你最少需要多少操作才能读完所有未读的信。 思路: 贪心。有信没读就进去读,读完一排连续的信后,才跳出list去找下一排未读的信。即统计下有几个1和几个1的连续区间-1就是答案。 #include const int MAX=1005; int n,a[MAX]; int main(){ scanf("%d",&n); i原创 2016-07-22 21:31:33 · 228 阅读 · 0 评论 -
Codeforces 464A No to Palindromes!
题意: 给你n长度的字符串(保证给出的字符串里不出现回文子串)和p表示可以选择前p个小写字母,问你该字符串字典序的下一个满足不出现任何回文子串的字符串是哪个。 思路: #include const int MAX=1005; char s[MAX]; int main(){ int n,p; scanf("%d%d",&n,&p); scanf("%s",s+1); bool f原创 2016-07-23 00:21:04 · 295 阅读 · 0 评论 -
Codeforces 464B Restore Cube
题意: 思路: #include #include using namespace std; typedef __int64 LL; LL p[10][5]; int order[10][5]; bool ok(){ LL dis[35]; for(int i=1;i<=8;i++){ int cnt=0; for(int j=1;j<=8;j++){ if(i==j)原创 2016-07-22 21:42:01 · 251 阅读 · 0 评论 -
Codeforces 468C Hack it!
题意: 定义一个计算f(1234)=1+2+3+4。现在给你a的值为0。 思路: 先来算算0~1e18的区间和为多少,在纸上列出几个式子: 0~9=45 0~99=45*10+450=900 0~999=900*10+4500=13500 ........可以发现,每次计算都和上一次有关,推得 0~99...9(18个9)=81*1e18 那么,现在有了这个值,我们就可以来搞一些原创 2016-07-23 18:26:35 · 858 阅读 · 0 评论 -
Codeforces 468B Two Sets(超直白解释)
题意: 给你a,b和n个数p[i],问你如何分配这n个数给A,B集合,并且满足: 若x在集合A中,则a-x必须也在集合A中。 若x在集合B中,则b-x必须也在集合B中。 思路:原创 2016-07-22 21:25:35 · 1643 阅读 · 0 评论