10 2014 档案
摘要:#include #include #include #include #include using namespace std;const int N=260;string str[N];bool ffflag=true;struct Node{ string num; string ...
阅读全文
摘要:已知前序中序求后序#include #include #include #include using namespace std;string po;void Computing(string pre,string in){ int len=pre.length(); if(len>0)...
阅读全文
摘要:/*题目描述有问题,发牌是从k开始发到A 然后最上面一层是输入的第一行,第二层是第二行,以此类推*/#include #include #include #include using namespace std;struct card{ int vis,num; char color;}...
阅读全文
摘要:存在的问题:用string 显示 runtime error 还有就是效率超低,1890ms险过,还是不够#include #include #include #include #include #include using namespace std;int n,m;struct node{ ...
阅读全文
摘要:水题,但是忘了清空队列结果就悲剧了。#include #include #include #include #include using namespace std;struct Card{ char num; int determin;};struct cmp{ bool ope...
阅读全文
摘要:STL学习之priority_queue 题意就是在一段时间内有用户注册要求每行先输入命令(Register/"#")如果是Register就输入用户的id和输出这个id的时间间隔(每经过指定的时间间隔就输出该用户名),如果是#结束输入,最后输入一个数字ans,要求按照时间输出前ans个用户名,如果...
阅读全文
摘要:说是水题,代码还是有点烦人的,思想就是先打表再输出#include#include#include#include#include using namespace std;map wd;void dabiao(){ int cnt=1; char temp[6]; for(cha...
阅读全文
摘要:水题#include #include #define N 103using namespace std;char w[N][N];int n,m;void dfs(int x,int y){ w[x][y]='.';//把现在所在位置替换为 . for(int dx=-1;dx>w[i...
阅读全文
摘要:刚开始这道题读数据时用了stringstream和getline,结果超时了,也不知道哪里超了,改了半天最后才想到输入,改掉输入就ac了#include #include #include #include using namespace std;int n,ans;int way[150][150...
阅读全文
摘要:参考了http://blog.csdn.net/xuezhongfenfei/article/details/8523380//poj 1011 dfs#include #include #include #include using namespace std;int n,st[100];int ...
阅读全文
摘要:再次证明严谨的思维是ac的保证,这次自以为考虑到了所有情况,却栽在了数组这块,处理时从0开始,而输入依赖的工作序号却是从一开始,wrong了一下,找错找了半天才反应过来,果然是菜。解题思路,简单dfs,看成一个有向图,不知道怎么描述,反正就是直接找每个点"依赖"的点有多少,输出最多的。附代码#inc...
阅读全文
摘要:题意:一个人想从家走遍整个城市,不走重复的路,问有没有可能。明显的欧拉问题。输入:第一行两个数字,前一个代表有N个点,后一个代表R条路,接着输入这r条路分别连着哪两个点。判断是否连通:任意一个点是否可以访问所有节点。判断是否欧拉回路:离散数学中有讲过,图论知识,判断每个点的度数是否为偶数度。这题坑的...
阅读全文
摘要:写程序果然是要静心,不然就漏洞百出。一道简单的dfs竟然wa了好多次。题解:必有一胜,所以只判断black胜不胜就够了。black胜利的条件是能从第一行走到最后一行,white的胜利条件是能出第一列走到最后一列,要注意的是不(i,j)不能到(i+1,j-1)和(i-1,j+1)。#include #...
阅读全文
摘要:简单模拟,有人用dfs写的,貌似更高端,由于测试数据不是很大,效率也不低,时间大概是几毫秒吧,在学校的virtual judge上居然是0毫秒,好亮。。。。(用了面向对象,或许也不能称之为面向对象。。。。。)#include #include using namespace std;int n;ch...
阅读全文
摘要:简单的dfs,比模板还简单,题意是一个人从@出发,依次通过IEHOVA到达“#”,要求输出他走的方法。规定只能向前“forth”,向左“left”,向右“right”。#include #include using namespace std;int m,n;char str[1000][1000]...
阅读全文
摘要:简单dfs,输出时按照数字从大到小的顺序输出,数字大小相等则按字母由前往后的顺序输出。#include #include #include #include using namespace std;int H,W;char le[10000][10000];int dir[4][2]={{-1,0}...
阅读全文

浙公网安备 33010602011771号