
CF
文章平均质量分 68
xxx_bug
这个作者很懒,什么都没留下…
展开
-
CF 1B Spreadsheet
算是比较水的题。字符没有很难的处理。但是看看自己的代码和神牛的代码,差距实在太大~我的代码:#include using namespace std;bool is(string s){ int i,len; len = s.size(); if(s[0] == 'R'&&(s[1]>='0'&&s[1]<='9')) { for(原创 2012-03-28 20:12:30 · 670 阅读 · 0 评论 -
cf 121 ABC
我只会这些比较水的题。A. Funky Numbers这道题一开始卡了一下,其实都很简单的,只不过很快的想着记忆化了。看了下数据,果断的想公式。#include #include #include #include #include #include #include #include #include #include using namespace std;b原创 2012-05-28 16:30:30 · 462 阅读 · 0 评论 -
CF 128A Statues
思维从未深入的思考!这道题的突破点就是,只要M能存在超过8步,那么就能成功到达!所以DFS9个位置即可!而S一步下落一次,那么走到step,那么S也就下降了step,所以全部状态就可知了! 反省了一下自己的思考,一开始就在想能不能BFS所有的状态,但是很明显这种方法的结果就是果断地爆了内存。也有可能TLE。然后我就想能不能找到规律,最后还是想不到,我还是没有很好的抓住问题的突破点,然后原创 2012-04-12 19:46:02 · 585 阅读 · 0 评论 -
CF 5C Longest Regular Bracket Sequence
把所有规则括号都记录起来即可!然后统计连续的规则串,用map来记录!用栈模拟!不难#include #include #include #include #include #include #include #include #include #include using namespace std;stack s;int cot[1000000];map原创 2012-04-09 22:32:07 · 863 阅读 · 0 评论 -
CF 4D Mysterious Present
dfs题!!用Dp!可是就这么简单的思路,我偏偏绕远路,用LCS来DP求,被无情的MLE!#include#includeusing namespace std;int dfs(int);int w[5001],h[5001],d[5001],p[5001],n;main(){ cin>>n; for(int i=0;i<=n;i++) cin>>w[i]>>h[i]; m原创 2012-03-30 19:14:02 · 510 阅读 · 0 评论 -
CF 3D Least Cost Bracket Sequence
怎么也想不出那些大牛一样的思路啊~难道是我自己没有仔细想的缘故!?贪心~ (其实贪心就是对“状态”而言的,以前都想错了~以为就是简单地对现阶段来贪心,其实只要总的状态得到贪心的话,要记录以前的阶段来比较)匹配括号,? 一开始设定为 ) 然后去判断是否有括号未配对,如果有的话,就贪心一个最小的阶段。当然这个要用一个容器来记录,当然首选优先队列。很好的题~#include #inclu原创 2012-03-29 22:31:25 · 906 阅读 · 0 评论 -
CF 3C Tic-tac-toe
考虑全面!!#include using namespace std;char m[3][3];bool fwin(){ if((m[0][0] == m[0][1]&&m[0][1]==m[0][2]&&m[0][0] == 'X')|| (m[1][0] == m[1][1]&&m[1][1]==m[1][2]&&m[1][0] == 'X')||原创 2012-03-29 19:41:45 · 619 阅读 · 0 评论 -
CF 3B Lorry
很经典的贪心。思路:这题如果用DP的话,会超内存并且很难记录是那些点。开两个数组,一个记录type 1的,一个记录type 2的。然后都排序,然后逐个累加。比如test3:10 101 142 152 112 122 91 142 151 92 112 6分开排序后:1 141 141 92 152 152 122 112原创 2012-03-29 18:38:42 · 613 阅读 · 0 评论 -
CF 3A Shortest path of the king
这题我傻逼还用BFS。看了别人的代码我彻底无语~#include #include #include using namespace std;int main(){ string a,b; while(cin>>a>>b) { int m = abs(a[0]-b[0]); int n = abs(a[1]-b[1]);原创 2012-03-29 01:04:32 · 658 阅读 · 0 评论 -
CF 2A Winner
也是简单的实现题,还是在学习大牛的代码!我的代码:#include #include using namespace std;struct P{ string name; int s;}p1[1010],p2[1010];bool cmp(P a,P b){ return a.s > b.s;}int main(){ int n,i,j,k原创 2012-03-28 22:29:39 · 562 阅读 · 0 评论 -
CF 201B Guess That Car!
公式拆分。一个点 到每个方块的Distance可以拆分为:dx^2 + dy^2;第一个example~:(1,1) : c[1][1]*dx[1][1] + c[1][1]*dy[1][1] + c[1][2]*dx[1][2] + c[1][2]*dy[1][2] + c[1][3]*dx[1][3] + c[1][3]*dy[1][3] +原创 2012-07-11 01:41:01 · 660 阅读 · 0 评论