随笔分类 -  杭电多校赛第三场

杭电多校赛第三场
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 阅读(217) 评论(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 阅读(446) 评论(0) 推荐(0)

HDU4627
摘要:1 /*找规律,n是奇数那么就是n/2和n/2+1 2 如果n是偶数,那就是两种情况n/2-1,和n/2-2两种,比较一下大小就可以 3 思路来自:http://www.cnblogs.com/freezhan/ 4 */ 5 #include 6 #include 7 __int64 gcd(__int64 a,__int64 b) 8 { 9 if(b==0) return a;10 return gcd(b,a%b);11 }12 __int64 LMC(__int64 a,__int64 b)13 {14 return a/gcd(a,b)*b;15 }16 ... 阅读全文

posted @ 2013-07-30 20:40 ok_boy 阅读(210) 评论(0) 推荐(0)

导航