Codeforces Round #197 (Div. 2) C,D两题】的更多相关文章

开了个小号做,C题一开始看错范围,D题看了半小时才看懂,居然也升到了div1,囧. C - Xenia and Weights 给出一串字符串,第i位如果是1的话,表示有重量为i的砝码,如果有该种砝码的话,数量有无限多个. 现在往天平的两侧放入,每次放入的要求: 1.每次放入时和上次放入的砝码的重量不能一样. 2.放入的那端天平必须必另一端重. 问能否放入n次,能的话,求放入方式. 分析: 比赛时看到很多人写的是贪心,但是想不到有什么好的数据叉掉他们,囧. 我写的是直接dfs爆搜.代码略吧. D…
题目传送门 /* 线段树的单点更新:有一个交叉更新,若rank=1,or:rank=0,xor 详细解释:http://www.xuebuyuan.com/1154895.html */ #include <cstdio> #include <iostream> #include <algorithm> #include <cstring> #include <string> #include <cmath> #include <…
这场比赛手速场+数学场,像我这样读题都读不大懂的蒟蒻表示呵呵呵. 第四题搞了半天,大概想出来了,但来不及(中途家里网炸了)查错,于是我交了两次丢了100分.幸亏这次没有掉rating. 比赛传送门:https://codeforces.com/contest/1080. A.Petya and Origami 题意:Petya要发出n张邀请函,每张请函需要2张红纸,5张绿纸,8张蓝纸.现在商店里有一些不同颜色的笔记本,每本中有k张颜色相同的纸,求最少要买几本笔记本. 这题就是一道模拟题,算出每种…
看了codeforces上的大神写的题解之后,才知道这道题水的根本! 不过相对前面两题来说,这道题的思维要难一点: 不过想到了水的根本,这题也真心不难: 方法嘛,就像剥洋葱一样,从外面往里面剥: 所以呢,dfs,每次往左或者往右找到乱序的那个元素,反转一下: 这样就行了,而且题目说了保证能够在三次内搞定: 证明我也不会,意思应该就是这样了! #include<cstdio> #include<vector> #include<algorithm> #define max…
http://codeforces.com/contest/339/ 这场正是水题大放送,在家晚上限制,赛后做了虚拟比赛 A,B 乱搞水题 C 我是贪心过的,枚举一下第一个拿的,然后选使差值最小的那个物品. code D 裸的线段树,几乎不用思考,push_up函数要注意一下即可 code E 最多三层,暴力搜一下.按以下两个方向搜索 1.找到左边第一个不匹配点l,从右往左找到标号为l的位置r,翻转区间<l, r> 2.找到右边第一个不匹配点r,从右往左找到标号为l的位置l,翻转区间<l…
A. Helpful Maths 题目大意 给一个连加计算式,只包含数字 1.2.3,要求重新排序,使得连加的数字从小到大 做法分析 把所有的数字记录下来,从小到大排序输出即可 参考代码 #include <iostream> #include <cstring> #include <cstdio> #include <algorithm> using namespace std; ; ]; ], n; int main() { scanf("%s…
D. Xenia and Bit Operations time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Xenia the beginner programmer has a sequence a, consisting of 2n non-negative integers: a1, a2, ..., a2n. Xenia…
A.Helpful Maths 分析:将读入的字符转化为数字,直接排个序就可以了. #include <cstdlib> #include <cstring> #include <cstdio> #include <algorithm> using namespace std; ; int seq[N]; int main() { char c; , idx = ; while ((c = getchar()) != EOF) { if (c == '+'…
哎....这次的比赛被安叔骂的好惨! 不行呢,要虐回来: 这道搜索,老是写错,蛋疼啊! 果然是基础没打好! #include<cstdio> using namespace std; ],m; ],flag=true; void dfs(int n,int ch,int x) { if(n>m) { flag=false; printf("YES\n"); ; i<n; ++i) printf(" %d",ans[i]); printf(&q…
这题也是一个线段树的水题: 不过开始题目没看明白,害得我敲了一个好复杂的程序.蛋疼啊.... 最后十几分钟的时候突然领悟到了题意,但是还是漏掉一个细节,老是过不去... 以后比赛的时候不喝啤酒了,再也不喝了.... 贴上代码: #include<cstdio> #include<cstring> #define maxn 262200 using namespace std; struct tree { int num; int l,r; tree *left,*right; }…
也是水题一个,不过稍微要细心点.... 贴代码: #include<iostream> using namespace std; long long n,m; ; int main() { ,t; cin>>n>>m; cin>>s; ans=s-; ;i<m;i++) { cin>>t; if(t<s) ans+=(n-s+t); else ans+=(t-s); s=t; } cout<<ans<<endl…
水题一个: 直接贴代码: #include<cstdio> #include<algorithm> #include<cstring> using namespace std; ]; ]; int main() { ; scanf("%s",s); ;i<strlen(s);i++) { if(s[i]!='+') num[cnt++]=s[i]-'; } ) {printf(;} sort(num,num+cnt); ;i<cnt-;i…
题目链接 传送门 思路 \(dp[i][j][k]\)表示第\(i\)次操作放\(j\)后与另一堆的重量差为\(k\)是否存在. 代码实现如下 #include <set> #include <map> #include <deque> #include <queue> #include <stack> #include <cmath> #include <ctime> #include <bitset> #i…
A. Helpful Maths time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Xenia the beginner mathematician is a third year student at elementary school. She is now learning the addition operation.…
D. Polyline 题目连接: http://www.codeforces.com/contest/617/problem/D Descriptionww.co There are three points marked on the coordinate plane. The goal is to make a simple polyline, without self-intersections and self-touches, such that it passes through…
B. Archer Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/312/problem/B Description SmallR is an archer. SmallR is taking a match of archer with Zanoes. They try to shoot in the target in turns, and SmallR shoots first. The…
最近比赛有点多,可是好像每场比赛都是被虐,单纯磨砺心态的作用.最近讲的内容也有点多,即便是点到为止很浅显的版块,刷了专题之后的状态还是~"咦,能做,可是并没有把握能A啊".每场网络赛,我似乎都没用上新学的东西,能用上新学东西的题我A不了...5555555555555555 这场CF,讲真,打的心态爆炸,首先A题无限WA,赛后看下WA的那组数据是输入有一个999999999的样例,死骗子,说好的数据是1e9呢,哪能有数据是1e10-1,于是用long long,一下子Accept接收不…
C. Cinema 题目连接: http://www.codeforces.com/contest/670/problem/C Description Moscow is hosting a major international conference, which is attended by n scientists from different countries. Each of the scientists knows exactly one language. For conveni…
A. Holidays 题目连接: http://www.codeforces.com/contest/670/problem/A Description On the planet Mars a year lasts exactly n days (there are no leap years on Mars). But Martians have the same weeks as earthlings - 5 work days and then 2 days off. Your tas…
B. Chips Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/333/problem/B Description Gerald plays the following game. He has a checkered field of size n × n cells, where m various cells are banned. Before the game, he has to…
C. Necklace 题目连接: http://www.codeforces.com/contest/613/problem/C Description Ivan wants to make a necklace as a present to his beloved girl. A necklace is a cyclic sequence of beads of different colors. Ivan says that necklace is beautiful relative…
CF链接  http://codeforces.com/contest/1011/problem/A Natasha is going to fly to Mars. She needs to build a rocket, which consists of several stages in some order. Each of the stages is defined by a lowercase Latin letter. This way, the rocket can be de…
文章目录 原题链接: A.Cirno's Perfect Bitmasks Classroom 思路 代码 B.Patchouli's Magical Talisman 思路 代码 C.Manipulating History 思路 代码 D.The Enchanted Forest 思路 代码 E.Railway System 题目大意 思路 代码 原题链接: # Name A Cirno's Perfect Bitmasks Classroom standard input/output 1…
http://codeforces.com/contest/426/problem/B B. Sereja and Mirroring time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Let's assume that we are given a matrix b of size x × y, let's determine…
B. Chocolate 题目连接: http://www.codeforces.com/contest/617/problem/D Descriptionww.co Bob loves everything sweet. His favorite chocolate bar consists of pieces, each piece may contain a nut. Bob wants to break the bar of chocolate into multiple pieces…
A. Elephant 题目连接: http://www.codeforces.com/contest/617/problem/A Descriptionww.co An elephant decided to visit his friend. It turned out that the elephant's house is located at point 0 and his friend's house is located at point x(x > 0) of the coord…
A. Bulbs 题目连接: http://www.codeforces.com/contest/615/problem/A Description Vasya wants to turn on Christmas lights consisting of m bulbs. Initially, all bulbs are turned off. There are n buttons, each of them is connected to some set of bulbs. Vasya…
A. Treasure Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/494/problem/A Description Malek has recently found a treasure map. While he was looking for a treasure he found a locked door. There was a string s written on the…
B. Rebranding Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/591/problem/B Description The name of one small but proud corporation consists of n lowercase English letters. The Corporation has decided to try rebranding — an…
后天考试,今天做题,我真佩服自己... 这次又只A俩水题... orz各路神犇... 话说这次模拟题挺多... 半个多小时把前面俩水题做完,然后卡C,和往常一样,题目看懂做不出来... A: 算是模拟吧,反正看懂题目后很可耻的生硬水果,没被hack我觉得非常开心... 由于要求两个人至少一个没跳过,画图后发现很偷懒的方法. 虽然跟样例不同,但过了... #include <cstdio> int main() { int n, m; scanf("%d%d", &n…