2013年7月31日

HDU4631(标程代码)

摘要: 1 /*将x从小到大排序,每次插入一个点,直接找比这个点的x大的第一个,然后从这个开始向两边找 2 ,找点的下标用多重容器实现*/ 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 using namespace std;10 struct point11 {12 __int64 x,y;13 bool operator M;46 for(i=1;i1)//从第二个点开始52 {53 multiset::iterator it=M.lower_bound... 阅读全文

posted @ 2013-07-31 16:22 ok_boy 阅读(212) 评论(0) 推荐(0)

HDU4628

摘要: 1 /*状态转移f[i]=min(f[i],f[j]+f[i^j]); 2 就是j状态+i^j状态=i状态,f[i]记录的是从i删除1要的最小步数*/ 3 #include 4 #include 5 #include 6 using namespace std; 7 const int N=100010; 8 int f[N]; 9 int n;10 char s[20];11 int min(int a,int b)12 {13 if(an时跳出24 while (r>=0&&(x&(1<<r))==0) r--;25 if (s[l]!=s[r]) 阅读全文

posted @ 2013-07-31 11:42 ok_boy 阅读(435) 评论(0) 推荐(0)

poj1185

摘要: 1 /*状态压缩就是把一系列用二进制表示的状态压缩成一个十进制数*/ 2 #include 3 #include 4 #include 5 using namespace std; 6 int s[65],dp[150][65][65],cont=0,sum[65],map[150];//m为10根据要求每行最多60中状态 7 bool ok(int x) 8 { 9 if(x&(x0)17 {18 if(x&1) sum++;19 x>>=1;20 }21 return sum;22 }23 void init(int n)//... 阅读全文

posted @ 2013-07-31 09:55 ok_boy 阅读(331) 评论(0) 推荐(0)

导航