Codeforces Round #200 (Div. 2) 水题4道~
今晚是第200场,在div2水了几题水题。。。
第三题始终找不到思路,还是赛后做的。。。
嘛,这次总算是做出了三题,还没被hack,感觉还不错,不过这次实在太水了,rating没降实在不错~
姑且贴下代码吧~
A - Magnets
题意:01和10代表一个磁铁的两种摆法,1,0表示正负极,同性相斥异性相吸,问排成一排后会变成几组磁铁。
简单模拟。。。
代码:
/** Author: illuz <iilluzen[at]gmail.com>* Blog: http://blog.csdn.net/hcbbt* File: D.cpp* Create Date: 2013-09-15 01:30:30* Descripton: CF200.2 D*/#include <cstdio>#include <iostream>#include <stack>using namespace std;char ch;int main() {stack<char> s;while (scanf("%c", &ch) != EOF && ch != '\n') {if (s.empty())s.push(ch);else {char t = s.top();if (t == ch)s.pop();elses.push(ch);}}if (s.size())printf("No\n");elseprintf("Yes\n");return 0;}