随笔分类 -  模拟题

摘要:题意很浅显,给定当前下载任务的已选状态和最终状态,可以当过单选,全选,反选等三个操作达成,问最少的操作数分析:思维真的有很大的局限性,怎么就没想到去整理一下规律呢,一心只想着搜索,dp呀,虽然这俩方面都很水……看了大牛的解释,我也跟着恍然大悟了……View Code #include <stdio.h>#include <stdlib.h>#include <string.h>int main(){ char S[55],T[55]; int i,j; int Min,count[4],n; while (scanf("%d",& 阅读全文
posted @ 2012-04-17 21:11 枕边梦 阅读(195) 评论(0) 推荐(0)
摘要:纯模拟的题目,一开始用map偷懒,却一直WA了,用普通的方法其实也WA了很久名字之间可能有多个空格隔开吧,一开始一直从左边往右搜,覆盖空格的位置,但是到第二个空格的话,我就退出循环了,一直WA,换成从右往左搜,找到第一个就可以退出了,就这样,过了…………“A single blank space” 空白区呀,我错了,这就是英语水平的问题呀………………,一直以为是一个空格的意思View Code #include<iostream>#include<algorithm>using namespace std;struct name{ char str[100]; int 阅读全文
posted @ 2012-03-04 17:51 枕边梦 阅读(286) 评论(0) 推荐(0)
摘要:题意:纯模拟题,用N个优先队列表示ID为0~N-1的Resource再重载一下操作符即可,剩下的就是模拟了ID好的范围是10000,询问的次数也是10000,里面的hash操作是多余了,自己没有考虑清楚………………View Code #include<iostream>#include<algorithm>#include<queue>#define MAXN 10010using namespace std;struct node{ int pri,num; bool friend operator<(const node a,const node 阅读全文
posted @ 2012-02-26 10:56 枕边梦 阅读(192) 评论(0) 推荐(0)
摘要:hdu3350题意:按照宏定义的规则,计算一个给定的宏定义中‘+’的运算次数。分析:用栈实现的纯模拟的题目View Code #include<iostream>#include<algorithm>#include<stack>#define MAXN 1000+10using namespace std;struct number{ int x,num;};//保存出现过的数,以及该数字执行‘+’的次数stack<number> st;//保存出现过的数字stack<char> oper;//保存操作符char str[MAXN] 阅读全文
posted @ 2012-02-23 12:08 枕边梦 阅读(583) 评论(0) 推荐(0)