• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
 






Keep Strive

 
 

Powered by 博客园
博客园 | 首页 | 新随笔 | 联系 | 订阅 订阅 | 管理
上一页 1 2 3 下一页

2012年9月11日

hdu 1258 Sum It Up(深搜)
摘要: 题意:找到不重复的,加起来等于给定的数。连接:http://acm.hdu.edu.cn/showproblem.php?pid=1258View Code #include <iostream>#include <algorithm>using namespace std;int used[15];//标记的数int save[15];//保存更新的数int step[15];//输入的数int n,m;int sum,type;int cmp(int a,int b){ return a>b;}void dfs(int k,int x){ if(k==n) { 阅读全文
posted @ 2012-09-11 14:31 Keep Strive 阅读(215) 评论(0) 推荐(0)
 
hdu 2616 Kill the monster(深搜)
摘要: 题意:找到最小步骤杀死monster连接:http://acm.hdu.edu.cn/showproblem.php?pid=2616View Code #include <iostream>using namespace std;int map[15][3];int used[15];int n;int sum,temp,type;int Min=100000000;void dfs(int k,int m){ if(k==n+1)//当到达第K层的时候就不在递归下去了 { if(m>0) { return; ... 阅读全文
posted @ 2012-09-11 12:24 Keep Strive 阅读(322) 评论(0) 推荐(0)
 
hdu 1180 诡异的楼梯(广搜)
摘要: 题意:给定起点和终点,算时间。注意:判断扩展的点为'|'或者'-'时,到达此点楼梯的状态。本来能有优先队列做的,我犯贱咯!等一天补上优先队列的代码;连接:http://acm.hdu.edu.cn/showproblem.php?pid=1180View Code #include <iostream>using namespace std;#include <queue>const int MAX = 20+10;char map[MAX][MAX];//bool used[MAX][MAX];int starti,startj,n,m 阅读全文
posted @ 2012-09-11 08:52 Keep Strive 阅读(694) 评论(0) 推荐(0)
 

2012年9月10日

HDU 2647Reward(拓扑图)
摘要: 题意:过年发奖金,起始奖金为888.越后者比前者多1元。问一共发了多少奖金。注意:数据中2 1 表示有两个员工,一组数据。接下来一组数据1 2 表示先给2发奖金,再给1发奖金。也就是1的奖金为889,2的奖金为888.连接:http://acm.hdu.edu.cn/showproblem.php?pid=2647View Code #include <iostream>using namespace std;#include <vector>const int MAX=10000+10;vector<int >map[MAX];int used[MAX]; 阅读全文
posted @ 2012-09-10 15:59 Keep Strive 阅读(226) 评论(0) 推荐(0)
 

2012年9月7日

HDU 3342 Legal or Not(深搜+拓扑)
摘要: 解题思路:没有环的拓扑图、连接:http://acm.hdu.edu.cn/showproblem.php?pid=3342View Code #include <iostream>using namespace std;const int MAX=100+10;int c[MAX];int topo[MAX][MAX];int map[MAX][MAX];int m;int n;int t;bool dfs(int k){ c[k]=-1; for(int i=0;i<n;i++) { if(map[k][i]) { if(... 阅读全文
posted @ 2012-09-07 21:35 Keep Strive 阅读(189) 评论(0) 推荐(0)
 
hdu 1087 Super Jumping! Jumping! Jumping!(简单动态)
摘要: 题意:求出最大子序列和解题思路:i12345map[i]14235sum[i]153611定义一个map数组保存所输入的数据,sum数组保存到达此点的最大值(采用松弛操作),在用max找最大值。注意:可能全为负数。我坑了3次。连接:http://acm.hdu.edu.cn/showproblem.php?pid=1087View Code #include <iostream>using namespace std;int main(){ int n; while(scanf("%d",&n),n) { int sum[1100]; in... 阅读全文
posted @ 2012-09-07 20:41 Keep Strive 阅读(168) 评论(0) 推荐(0)
 
hdu 1285 确定名次排名(拓扑排序)
摘要: 题意:确定名次排名,符合条件的排名可能不是唯一的,此时要求输出时编号小的队伍在前;输入数据保证是正确的,即输入数据确保一定能有一个符合要求的排。注意事项:判重连接:http://acm.hdu.edu.cn/showproblem.php?pid=1285View Code #include <iostream>using namespace std;const int MAX=500+10;int map[MAX][MAX];int indegree[MAX];int main(){ int n; int m; while(~scanf("%d%d",& 阅读全文
posted @ 2012-09-07 19:24 Keep Strive 阅读(253) 评论(0) 推荐(0)
 

2012年9月6日

HDU 3371 Connect the Cities (Prim算法)
摘要: 题意:n总共有多少个城市;m:有多少条路;k:相连的城市有多少组。对于K:输入2是表示有两组城市有已建好的路再输入一个T 表示 这T个城市相连。几map值 为0;连接:http://acm.hdu.edu.cn/showproblem.php?pid=3371View Code #include <iostream>using namespace std;#define INF 0x7ffffff#define MAX 500+10int n,m,k;int map[MAX][MAX];int used[MAX];int dis[MAX];int sum;int step[MAX] 阅读全文
posted @ 2012-09-06 10:06 Keep Strive 阅读(193) 评论(0) 推荐(0)
 

2012年9月5日

hdu 1875畅通工程再续(Prim算法)
摘要: 题意:找出一条路是所有岛都联通,如果找不到就输出oh!。解题思路:本体用的是Prim算法,模板里面加一个for判断是否存在一条路能走完所有岛。在输入时判断两个岛之间的距离。View Code #include <iostream>#include <cmath>using namespace std;#define INF 0x3fffffff#define MAX 100+10double map[MAX][MAX];int used[MAX];double dis[MAX];double sum;int n;int type;struct node{ double 阅读全文
posted @ 2012-09-05 21:06 Keep Strive 阅读(176) 评论(0) 推荐(0)
 
hdu1102 Constructing Roads(Prim算法)
摘要: 题意:给出几个村庄修路所花费的费用,现在再给出几组已经有路的村庄。输出这些村庄联通所要生成的最小费用。处理:把已经存在的路更新为0就行了。初始化map数组时初始为-1即可。连接:http://acm.hdu.edu.cn/showproblem.php?pid=1102View Code #include <iostream>#include <cmath>using namespace std;#define INF 0x3fffffff#define MAX 100+10int map[MAX][MAX];int used[MAX];int dis[MAX];int 阅读全文
posted @ 2012-09-05 20:49 Keep Strive 阅读(150) 评论(0) 推荐(0)
 
上一页 1 2 3 下一页