![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
算法/数据结构
文章平均质量分 74
rightbag
这个作者很懒,什么都没留下…
展开
-
poj1753 Flip Game
<br />#include<iostream><br /> using namespace std;<br /> //#define REVERSE(DATA,BIT) DATA^(1<<BIT)<br /> bool v[65535];<br /> int head,tail;<br /> struct point{<br /> int dis;<br /> unsigned short state;<br /> };<br /> p原创 2010-11-27 00:46:00 · 715 阅读 · 0 评论 -
poj1077Eights
#include #include using namespace std; #define MAX_SIZE 362880 //一共可能出现得状态,9! //hash struct node{ char state[9]; char space;//x所在位置 int pre; int value_hash; }; node q[MAX_SIZE]; char v[MAX_SIZE]; int p[MAX_SIZE]; char move[MAX原创 2010-11-27 00:55:00 · 807 阅读 · 0 评论 -
杭电1238 Substrings
<br />源码(C++):<br />#include <iostream><br /> #include <string><br /> using namespace std;<br /> int main()<br /> {<br /> int n,m,s,j,k,index,len,curlen,t;<br /> cin>>n;<br /> string str,substr,substrr;<br /> while(n)<br /> {<b原创 2010-11-19 20:01:00 · 1110 阅读 · 0 评论 -
杭电1239 Calling Extraterrestrial Intelligence Again
源码(C++):#include #include using namespace std; int main() { int m,a,b,i,j,flag,r1,r2,max; int s=0,array[1229]; max=0; r1=0; r2=0; for(i=2;i { for(j=2;j { if(i%j==0) {原创 2010-11-19 20:04:00 · 813 阅读 · 0 评论 -
杭电hoj1238老出现WA,请教是何原因
#include #include using namespace std; int main() { int n,m,s,j,k,index,len,curlen,t; cin>>n; if(n10) exit(0); string str,substr,substrr; while(n) { cin>>s; if(!(s=1)) exit(0);原创 2010-11-19 15:21:00 · 1065 阅读 · 0 评论 -
HDOJ_1010 Tempter of the Bone
程序采用递归方式:源码:#include #include using namespace std; #define MAX 7 char a[MAX][MAX]; int d[4][2]={{0,1},{1,0},{0,-1},{-1,0}}; void f(int x_b,int y_b,int x_e,int y_e,int t); bool flag=false; int N,M,T; int main() { int i,j; int x_b,y_b,x_e原创 2010-11-21 10:00:00 · 815 阅读 · 0 评论 -
poj3414pots
//此题采用广搜,找到满足条件的最小步数 #include #include using namespace std; #define MAX 101 int v[MAX][MAX]; int A,B,C; bool flag; struct node{ int a,b; int op,pre; int l; }; void f(); int main() { int i=0,j=0; flag=false; for(i=0;i>A>>B>>C;原创 2010-11-21 22:19:00 · 787 阅读 · 0 评论 -
poj2243 Knight Moves
<br />#include<iostream><br /> #include<queue><br /> using namespace std;<br /> struct d_node{<br /> int a,b;<br /> };<br /> d_node d[8]={{-2,1},{-1,2},{1,2},{2,1},{2,-1},{1,-2},{-1,-2},{-2,-1}};<br /> int visited[8][8];<br /> struct state_node{<b原创 2010-11-21 22:31:00 · 803 阅读 · 0 评论 -
杭电动态规划习题
<br />Robberies http://acm.hdu.edu.cn/showproblem.php?pid=2955<br />背包;第一次做的时候把概率当做背包(放大100000倍化为整数):在此范围内最多能抢多少钱 最脑残的是把总的概率以为是抢N家银行的概率之和… 把状态转移方程写成了f[j]=max{f[j],f[j-q[i].v]+q[i].money}(f[j]表示在概率j之下能抢的大洋);<br />正确的方程是:f[j]=max(f[j],f[j-q[i].money]*q[i].v)转载 2011-02-25 13:47:00 · 894 阅读 · 0 评论