上一页 1 ··· 53 54 55 56 57 58 59 60 61 ··· 71 下一页
摘要: http://poj.org/problem?id=1062poj计划里最短路题 用DFS做的。。弄了一下午 终于搜过了 注意 全局的最大跟最小值的差不能超过它所规定的限制View Code 1 #include <iostream> 2 #include<cstdio> 3 #include<string.h> 4 using namespace std; 5 int m,mi,xf[111],flag,minn,maxx; 6 struct node 7 { 8 int p,l,x; 9 int t[101],v[101];10 }q[101];11 v 阅读全文
posted @ 2012-08-13 17:44 _雨 阅读(215) 评论(0) 推荐(0) 编辑
摘要: http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=1500View Code 1 #include <iostream> 2 #include<cstdio> 3 #include<string.h> 4 #include<stdlib.h> 5 using namespace std; 6 struct node 7 { 8 int flag; 9 node *next[27];10 node()11 {12 flag = 0;13 m... 阅读全文
posted @ 2012-08-13 14:42 _雨 阅读(163) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1075难得的1A 把对应的英语单词存在 火星文字最后一个字母的结构体字符串中 挨个找View Code 1 #include <iostream> 2 #include<cstdio> 3 #include<string.h> 4 #include<stdlib.h> 5 using namespace std; 6 int flag; 7 struct node 8 { 9 int flag; 10 char s[21]; 11 node *next[27]; 阅读全文
posted @ 2012-08-13 11:27 _雨 阅读(192) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1247先找某个单词是否为一个单词的前缀 再用 这个单词减去前缀 判断剩下的部分是否为一个单词View Code 1 #include <iostream> 2 #include<stdlib.h> 3 #include<cstdio> 4 #include<string.h> 5 using namespace std; 6 char c[50001][101]; 7 struct node 8 { 9 int flag;10 node *next[27];11 阅读全文
posted @ 2012-08-13 10:26 _雨 阅读(187) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=3339最短路+01背包以耗油量为V 以pow为价值View Code 1 #include <iostream> 2 #include<cstdio> 3 #include<string.h> 4 using namespace std; 5 #define INF 0x3f3f3f 6 int w[101][101],p[101],pi[101],f[10001]; 7 int main() 8 { 9 int i,j,k,n,m,t,a,b,c,v;10 scanf(& 阅读全文
posted @ 2012-08-12 23:01 _雨 阅读(176) 评论(0) 推荐(0) 编辑
摘要: A - Building a Space StationCrawling in process...Crawling failedTime Limit:1000MS Memory Limit:30000KB 64bit IO Format:%I64d & %I64uSubmitStatusDescriptionYou are a member of the space station engineering team, and are assigned a task in the construction process of the station. You are expected 阅读全文
posted @ 2012-08-11 15:05 _雨 阅读(361) 评论(3) 推荐(0) 编辑
摘要: CZ写的三分模板View Code 1 #include <stdio.h> 2 #include <string.h> 3 #include <stdlib.h> 4 #include <math.h> 5 #define eps 1e-9 6 double a,b; 7 double getsum(double c) 8 { 9 double p,sum = 0;10 p = (a+b+c)/2;11 sum += sqrt(p*(p-a)*(p-b)*(p-c));12 sum += c*c/4;13 return sum;14 }15 i 阅读全文
posted @ 2012-08-10 20:40 _雨 阅读(167) 评论(0) 推荐(0) 编辑
摘要: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=598这题题意看了老半天 让求图形中的X的区域块数 每个区域有多少个X是不相连的 DFS搜有多少个区域 BFS标记 有每个区域里多少X区域块注意两点吧 WA了5次 第一个可能为X 就直接BFS 再DFS第二 BFS中遇到的*要保留起来 把相连的X标记完之后 继续搜 不然区域块数会被分开View Code 1 #include <iostream> 2 #include&l 阅读全文
posted @ 2012-08-10 20:31 _雨 阅读(325) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1114初始化为无穷大View Code 1 #include <iostream> 2 #include<cstdio> 3 #include<string.h> 4 #define INF 0xfffffff 5 using namespace std; 6 int main() 7 { 8 int i,j,k,n,t,f[10001],v,p[501],w[501]; 9 scanf("%d", &t);10 while(t--)11 {12 阅读全文
posted @ 2012-08-10 16:34 _雨 阅读(185) 评论(0) 推荐(0) 编辑
摘要: http://www.cppblog.com/tanky-woo/archive/2010/07/31/121803.htmlhttp://dongxicheng.org/structure/knapsack-problems/01背包(ZeroOnePack): 有N件物品和一个容量为V的背包。(每种物品均只有一件)第i件物品的费用是c[i],价值是w[i]。求解将哪些物品装入背包可使价值总和最大。这是最基础的背包问题,特点是:每种物品仅有一件,可以选择放或不放。用子问题定义状态:即f[i][v]表示前i件物品恰放入一个容量为v的背包可以获得的最大价值。则其状态转移方程便是:f[i][v]= 阅读全文
posted @ 2012-08-10 14:57 _雨 阅读(290) 评论(0) 推荐(0) 编辑
上一页 1 ··· 53 54 55 56 57 58 59 60 61 ··· 71 下一页