
poj
code&day
sdfsdffsdf
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
poj 1316
dfs+筛法 在一些问题中,需要判断一系列数是否具有某种性质,这种性质,通常需要往前搜索,比如判断一个数是否是素数,或者像这题中的自数,可以通过筛法,逐步过滤掉不符合条件的数,往往可以用dfs。 #include<cstdio> #include<cstring> #include<iostream> using namespace std; const...原创 2018-02-27 20:04:21 · 209 阅读 · 0 评论 -
poj 2258
题意:求n个节点的无向图中的最长路径。 回溯法+dfs 这题的回溯法的边界条件需要用一个flag来判读。 第10行的错误,我忽视了for里条件不满足就退出,以为可以跳过去。 #include <cstdio> #include<iostream> #include<cstring> using namespace std; int s[25][25]; ...原创 2018-03-09 18:10:56 · 287 阅读 · 0 评论 -
poj 1011
#include<cstdio> #include<algorithm> #include<functional> #include<cstring> #include<iostream> using namespace std; const int maxn=70; int len,used[maxn],s[maxn],n; bool ...原创 2018-03-04 16:39:30 · 168 阅读 · 0 评论 -
poj 1979
poj 1979 #include<cstdio> #include<cstring> #include<iostream> using namespace std; char s[30][30]; int vis[30][30]; int r,c;int ans; void dfs(int x,int y){ if(vis[x][y]||x<0...原创 2018-03-04 18:29:20 · 314 阅读 · 0 评论 -
poj 1270拓扑排序
poj 1270 #include<cstdio> #include<queue> #include<cstring> #include<algorithm> char s[150]; int sufix[30][30],ind[30], topo[30]; int n=0; void print(){ for(int i=0;i<...原创 2018-04-20 19:29:27 · 270 阅读 · 0 评论 -
3470 整理扑克牌
题目链接 思路1.简单模拟+贪心,每次选择数目最少的牌,用特俗牌替代它,组合成一副牌,直到特殊牌数目为0,然后可以再组合出所剩最少数目副牌。 #include<iostream> #include<cstdio> #include<cmath> #include<cstdlib> #include<cstring> #includ...原创 2018-06-06 14:54:44 · 1192 阅读 · 0 评论