上一页 1 ··· 23 24 25 26 27 28 29 30 31 ··· 50 下一页
摘要: problem一个有n个数的环每次只能向相邻的数移动,移动一个数代价为1求让所有数相等的最小代价solution一:思路 1、纸牌均分问题每行答案是∑i=1n|i∗T/n−G[i]|" role="presentation" ... 阅读全文
posted @ 2018-05-30 12:31 gwj1139177410 阅读(149) 评论(0) 推荐(0) 编辑
摘要: problemsolutioncodes//思路:把空白当棋,交替黑白走。//实现:BFS, 打表判断是否成立#include#include#include#includeusing namespace std;string s;struct node{ st... 阅读全文
posted @ 2018-05-29 21:38 gwj1139177410 阅读(113) 评论(0) 推荐(0) 编辑
摘要: problemsolutioncodes//step1:把n个苹果放到m个盘子里,不允许有空盘。等价于每个盘子放一个苹果先允许有空盘//step2:f[i][j]表示i个苹果j个盘子的放法数目//step3:转移,j>i时,去掉空盘不影响结果; jusing name... 阅读全文
posted @ 2018-05-29 21:33 gwj1139177410 阅读(130) 评论(0) 推荐(0) 编辑
摘要: problemsolutioncodes//f[i][j]:从(i,j)出发能获得的最大值 _裸DFS#include#includeusing namespace std;int n, a[110][110], f[110][110];int dfs(int i, ... 阅读全文
posted @ 2018-05-29 21:31 gwj1139177410 阅读(152) 评论(0) 推荐(0) 编辑
摘要: problemsolutioncodes//bugs:行列弄反(x,y是坐标轴...)+longlong#includeusing namespace std;typedef long long LL;LL n, m, x1, y1, x2, y2, f[55][55... 阅读全文
posted @ 2018-05-29 21:29 gwj1139177410 阅读(224) 评论(0) 推荐(0) 编辑
摘要: problemsolutioncodes//填表法#includeusing namespace std;int n, m, x, y, a[20][20], f[20][20];int main(){ cin>>n>>m>>x>>y; x++;y++;n++;... 阅读全文
posted @ 2018-05-29 21:27 gwj1139177410 阅读(139) 评论(0) 推荐(0) 编辑
摘要: problemsolutioncodes//f[i]:到第i条线段为止能获得的最大价值//f[i]=max{s[i].c,f[j]+s[i].c|j#includeusing namespace std;const int maxn = 1010;struct seg... 阅读全文
posted @ 2018-05-29 21:25 gwj1139177410 阅读(103) 评论(0) 推荐(0) 编辑
摘要: problemsolutioncodes//数据太水,搜索就好#include#includeusing namespace std;int n, m, a[110];int search(int i, int r){ if(i == n)return r; ... 阅读全文
posted @ 2018-05-29 21:23 gwj1139177410 阅读(107) 评论(0) 推荐(0) 编辑
摘要: problem给出一个连通无向图,判断它的最小生成树是否唯一如果唯一,输出生成树的大小,否则输出”Not Unique!”solution直接求非严格次小生成树如果次小生成树等于最小生成树则说明最小生成树不唯一,否则最小生成树一定是唯一的vector会TLE。。。co... 阅读全文
posted @ 2018-05-29 21:15 gwj1139177410 阅读(109) 评论(0) 推荐(0) 编辑
摘要: 一、主要算法Prim给定一张无向图,求它的最小生成树。初始时我们将s打上标记。对于每个未标记的点i,我们记f[i]表示i连向已标记的点的边中,边权(到生成树距离)的最小值。每次我们找到未标记的点中f最小的,将它打上标记并更新其余点的f值。时间复杂度O(n2),用堆维护... 阅读全文
posted @ 2018-05-29 12:30 gwj1139177410 阅读(129) 评论(0) 推荐(0) 编辑
上一页 1 ··· 23 24 25 26 27 28 29 30 31 ··· 50 下一页
选择