题意:给出n,m,人的编号为 0到n-1,再给出m个关系,问能不能够进行拓扑排序#include #include #include #include using namespace std;int indegree[1005],queue[1005],head[1005];struct E...
分类:
编程语言 时间:
2015-02-07 10:18:38
阅读次数:
157
明天再拍一遍 1 #include 2 #include 3 using namespace std; 4 const int N = 210; 5 const int INF = 0x7FFFFFFF; 6 int n,m,map[N][N],path[N],flow[N],start,end.....
分类:
其他好文 时间:
2015-02-07 10:13:30
阅读次数:
98
之前被教过一个next_permutation库函数,是用来实现数的全排列的,具体实现见代码#include#include#includeusing namespace std;int main(){ int a[1000]; int n; while(scanf("%d",&n...
分类:
其他好文 时间:
2015-02-07 00:29:22
阅读次数:
536
题意 一个n*m的环形矩阵(第一行和最后一行是相邻的) 从第一列任意位置出发 只能往右上,右,右下3个方向走 求走到第m列经过的的最小数字和
基础DP 横着的数塔问题
#include
#define l(x) d[x][j+1]
using namespace std;
const int N = 105;
int n, m, g[N][N], d[N][N], fol[N][N...
分类:
其他好文 时间:
2015-02-06 23:16:54
阅读次数:
435
http://acm.hdu.edu.cn/showproblem.php?pid=1536题意:同nim...多堆多询问...单堆n#include using namespace std;bool b[105];int s[105], f[10005];int main() { int k, m...
分类:
其他好文 时间:
2015-02-06 23:13:23
阅读次数:
174
匈牙利算法 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 using namespace std; 8 int n,m,t; 9 int vis[1002],link[1002],line[1002][1002...
分类:
编程语言 时间:
2015-02-06 23:12:05
阅读次数:
193
http://acm.hdu.edu.cn/showproblem.php?pid=1517题意:每次乘上2~9。。p>=n时赢..#include #include #include using namespace std;typedef long long ll;map h;ll n;bool ...
分类:
其他好文 时间:
2015-02-06 23:11:08
阅读次数:
159
滑动窗口挺有意思的,如果符合条件右端点一直向前走,不符合的话,左端点向前走。 1 #include 2 using namespace std; 3 4 set Set; 5 6 const int maxn = 1000000 + 10; 7 int a[maxn]; 8 9 int Sc...
分类:
其他好文 时间:
2015-02-06 23:10:45
阅读次数:
191
http://acm.hdu.edu.cn/showproblem.php?pid=1850题意:同nim...顺便求方案数...#include #include using namespace std;int a[105];int main() { int n; while(scanf("%d"...
分类:
编程语言 时间:
2015-02-06 23:08:32
阅读次数:
172
http://acm.hdu.edu.cn/showproblem.php?pid=1847题意:同nim..不过只有一堆..每次取2的幂次..即1、2、4....等,n#include using namespace std;int f[1005];int dfs(int n) { if(n==0...
分类:
其他好文 时间:
2015-02-06 23:08:24
阅读次数:
152