雕刻时光

just do it……nothing impossible
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
上一页 1 ··· 22 23 24 25 26 27 28 29 30 ··· 50 下一页

2012年4月2日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1237不用栈的形式View Code #include<stdio.h>#include<stack>#include<string.h>#include<iostream>using namespace std;char s[209];double num[209];char fu[209];int main(){ while(gets(s)) { if(s[0]=='0'&&strlen(s)==1) return 0; me 阅读全文

posted @ 2012-04-02 20:53 huhuuu 阅读(209) 评论(0) 推荐(0) 编辑

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4195组成多边形的边最小为多少1。先找三角形的垂心(注意线段垂直的情况)2。以垂心画圆YY,这个三角形可以把这个圆分成多少弧度(注意钝角三角形的第三边所对应的边的弧度为 2*PI的补数)3。接着枚举最小弧度的 n分之几,是否可以把其它弧度近似整除(如1801可以近似整除600)控制精度!!!View Code #include<stdio.h>#include<string.h>#include<math.h>#include<iostream>using na 阅读全文

posted @ 2012-04-02 18:59 huhuuu 阅读(417) 评论(0) 推荐(0) 编辑

2012年3月29日

摘要: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1788注意门与门之间可能有多条路!!输入可以连通就相应的边就 + INF判断 map[i][j]>=inf 反面就又map[j][i]=map[i][j]/inf 容量的路算最大流,if flow>=inf 则 入侵 else flowView Code #include<stdio.h>#include<string.h>int map[39][39];const int inf=100000000;const int MAXN=39;i 阅读全文

posted @ 2012-03-29 22:24 huhuuu 阅读(379) 评论(0) 推荐(0) 编辑

2012年3月28日

摘要: 类似于二分匹配的构图,相乘可以用log 后相加解决View Code #include<iostream>#include<cmath>#include<stdio.h>#include<string.h>using namespace std;const double inf=500.0;const int MAX=105;struct node{ int v,next; double c;}g[100000];int num[MAX],dis[MAX],cur[MAX],adj[MAX],pre[MAX];int s,t,e,vn,r,c,l 阅读全文

posted @ 2012-03-28 21:45 huhuuu 阅读(268) 评论(0) 推荐(0) 编辑

2012年3月26日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=3826判断一个数的约数是否开根号为一个整数,存在输出no,否则yes先1-1000,000之间的素数去试除该数,同一个素数有两次以上将其整除的话,是no,结束没结束,将余数开根号,看是否是一个整数,是no,否则yesView Code #include<stdio.h>#include<math.h>#include<string.h>int ha[1000005],shu[1000005];int main(){ int t,i,j,k; memset(shu,1,siz 阅读全文

posted @ 2012-03-26 21:20 huhuuu 阅读(471) 评论(0) 推荐(0) 编辑

2012年3月24日

摘要: http://poj.org/problem?id=3469网络流的模型:每个模块一个节点,原点与所有模块节点连接(称为上边),边权为第一个核对应该模块的开销。所有模块节点连接到汇点(称为下边),权为第二个核对应该模块的开销。然后需要数据交换的两个模块结点之间连接双向边(两个单向边,称为中边),权为对应的那个额外开销。View Code #include<cstdio>#include<cstring>#include<algorithm>using namespace std;const int MAXN = 20000;const int INF = 1 阅读全文

posted @ 2012-03-24 22:03 huhuuu 阅读(275) 评论(0) 推荐(0) 编辑

2012年3月22日

摘要: http://poj.org/problem?id=1637题意:混合图欧拉回路一开始想到是否可以用欧拉回路做,可是一想a->b ,a<->b可以同时并且多次存在时,不可行构图:有向边忽略,无向边任意定向。统计每个点的出入度(有向边当无向边)。对于任意一个点,若有出入度之差为奇数则不可能存在欧拉路。记|出度-入度|=K。对于出度大于入度的点从S向I连容量为K/2的边,对于出度小于入度的点从I向T连容量为K/2的边。原来的无向边,任意定向,从X向Y连容量1的边。求最大流,判每条从S流出的边的流量和all是否等于最大流,是则存在欧拉路否则不存在。注意点:会有重边出现!而且重边也要 阅读全文

posted @ 2012-03-22 21:51 huhuuu 阅读(672) 评论(0) 推荐(0) 编辑

2012年3月21日

摘要: 先 folyd 求出任意两点可以到达的距离,由于我们不知道最短距离为多少,所以用二分查找来逼近答案接着构建容量网络:增加 源点 (n+1),设置源点到牛的容量为1 (一开始以为是INF,显然是错的)增加 汇点 (0),设置汇点到机器的容量为 M在通过二分出来的那个答案,统计牛到机器的容量最后网络流最大流,继续二分,直到最佳答案View Code #include<stdio.h>#include<string.h>const int inf=100000000;const int MAXN=309;int map[MAXN][MAXN];int dis[MAXN][MA 阅读全文

posted @ 2012-03-21 22:36 huhuuu 阅读(334) 评论(0) 推荐(0) 编辑

摘要: http://poj.org/problem?id=1273人生第一题网络流O(∩_∩)O哈哈~注意数据有重边,要把值加上去View Code #include<stdio.h>const int inf=1000000000;const int MAXN=209;int map[MAXN][MAXN];int flow[MAXN][MAXN];int max_flow(int n,int mat[][MAXN],int source,int sink){ int v[MAXN],c[MAXN],p[MAXN],ret=0,i,j; for(;;){ for(i=0;... 阅读全文

posted @ 2012-03-21 19:47 huhuuu 阅读(370) 评论(0) 推荐(0) 编辑

2012年3月18日

摘要: http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1184优先小节点搜欧拉道路,如果有奇数入度节点要从这个节点出发。注意从小到大在算法遍历里是1->n!!!!path输出来时是n->0!!!! 要是以为算法遍历里是n->1,path输出来时是0->n那就错了数据42 31 23 11 2会输出:2 1 2 3 1 错!!!!View Code #include<stdio.h>#include<string.h>#include<iostream>#include<algorith 阅读全文

posted @ 2012-03-18 21:23 huhuuu 阅读(428) 评论(0) 推荐(0) 编辑

上一页 1 ··· 22 23 24 25 26 27 28 29 30 ··· 50 下一页