2014年4月27日

HDU1020 Encoding 简单队列

摘要: 简单队列 1 #include 2 #include 3 #include 4 using namespace std; 5 int main() 6 { 7 int n; 8 scanf("%d",&n); 9 queueq;10 char ch,str[10010... 阅读全文

posted @ 2014-04-27 11:25 >_< 阅读(81) 评论(0) 推荐(0) 编辑

HDU1412 {A} + {B} 简单队列

摘要: 优先队列 1 #include 2 #include 3 #include 4 using namespace std; 5 int main() 6 { 7 priority_queue,greater >q; 8 int temp; 9 int n,m;10 wh... 阅读全文

posted @ 2014-04-27 09:51 >_< 阅读(96) 评论(0) 推荐(0) 编辑

2014年4月26日

HDU1896 Stones 简单队列

摘要: 优先队列 1 #include 2 #include 3 using namespace std; 4 struct node 5 { 6 int p,d; 7 friend bool operatorb.d;10 return a.p>b.p;11 } ... 阅读全文

posted @ 2014-04-26 23:51 >_< 阅读(139) 评论(0) 推荐(0) 编辑

HDU 2037 今年暑假不AC 快排+贪心

摘要: 快排+贪心 1 #include 2 int a[110],b[110]; 3 void quicksort(int a[],int low,int high) 4 { 5 int i=low; 6 int j=high; 7 int temp=a[i]; 8 int... 阅读全文

posted @ 2014-04-26 16:44 >_< 阅读(112) 评论(0) 推荐(0) 编辑

HDU 1029 Ignatius and the Princess IV 简单map

摘要: 简单map 1 #include 2 #include 3 using namespace std; 4 int main() 5 { 6 int n; 7 int temp; 8 mapa; 9 map::iterator iter;10 while(sca... 阅读全文

posted @ 2014-04-26 16:35 >_< 阅读(136) 评论(0) 推荐(0) 编辑

2014年4月25日

HDU1242 Rescue 简单bfs

摘要: 求最小步数 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 char map[211][211]; 8 struct node 9 {10 int x,y,st... 阅读全文

posted @ 2014-04-25 10:52 >_< 阅读(140) 评论(0) 推荐(0) 编辑

HDU1026 Ignatius and the Princess I bfs(需要记录路径)

摘要: 一开始用递归显示路径会爆栈,后来用数组road[]保存路径就过了 1 #include 2 #include 3 #include 4 using namespace std; 5 int n,m; 6 char map[110][110],hp[110][110],flag[110][110]; ... 阅读全文

posted @ 2014-04-25 10:45 >_< 阅读(146) 评论(0) 推荐(0) 编辑

2014年4月17日

HDU1010 Tempter of the Bone dfs(奇偶减枝)

摘要: 直接搜索会超时,需要减枝(奇偶减枝)。#include#includeint n,m,t;char map[7][7];int x0,y0,x1,y1; int flag; int abs(int a) { a>0?:a=-a; return a;}void dfs(int t... 阅读全文

posted @ 2014-04-17 20:44 >_< 阅读(154) 评论(0) 推荐(0) 编辑

HDU1016 Prime Ring Problem 简单dfs

摘要: 数据比较小,可以先枚举出范围内所有的素数用来作判断。注意递归条件。 1 #include 2 int n; 3 int a[20],v[20]; 4 int prime[12]={2,3,5,7,11,13,17,19,23,29,31,37}; 5 int check(int a) 6 { 7 ... 阅读全文

posted @ 2014-04-17 08:56 >_< 阅读(142) 评论(0) 推荐(0) 编辑

导航