当前位置: 首页 > news >正文

网上商城建设网站定制开发制作书签

网上商城建设网站定制开发,制作书签,做抢单软件的网站,域名申请好后 如何建设网站题目链接#xff1a; http://acm.hust.edu.cn/vjudge/problem/307216Froggy FordTime Limit: 3000MS题意 青蛙过河#xff0c;河中有若干个石头#xff0c;现在你可以加一个石头#xff0c;使得青蛙从左岸跳到右岸的最大跳跃距离最小。 题解 把左岸和右岸作为两个虚节点 http://acm.hust.edu.cn/vjudge/problem/307216Froggy FordTime Limit: 3000MS 题意 青蛙过河河中有若干个石头现在你可以加一个石头使得青蛙从左岸跳到右岸的最大跳跃距离最小。 题解 把左岸和右岸作为两个虚节点用kruskal的思路处理出每个点到左岸需要跳跃的最大距离st[i]最优情况下和每个点到右岸的最大距离ed[i]然后枚举两个点在这两个点的中点放一个石头得到mamax(st[i],ed[j],dis(i,j)/2)如果这个值比答案更优就更新答案同时记录新放的石头的坐标。 代码 #includemap #includecmath #includequeue #includevector #includecstdio #includestring #includecstring #includeiostream #includealgorithm using namespace std; #define X first #define Y second #define mkp make_pair #define lson (o1) #define rson ((o1)|1) #define mid (l(r-l)/2) #define sz() size() #define pb(v) push_back(v) #define all(o) (o).begin(),(o).end() #define clr(a,v) memset(a,v,sizeof(a)) #define bug(a) cout#a aendl #define rep(i,a,b) for(int ia;i(b);i)typedef long long LL; typedef vectorint VI; typedef pairint,int PII; typedef vectorpairint,int VPII;const int INF0x3f3f3f3f; const LL INFL9e18; const double eps1e-8;const int maxn1111;LL w,n;pairLL,LL pt[maxn];LL dis(LL x1,LL y1,LL x2,LL y2){return (x1-x2)*(x1-x2)(y1-y2)*(y1-y2); }struct Edge{int u,v; LL w;Edge(int u,int v,LL w):u(u),v(v),w(w){}Edge(){}bool operator (const Edge tmp) const {return wtmp.w;} }egs[maxn*maxn];int tot; int fa[maxn]; int find(int x){return fa[x]fa[x]x?x:find(fa[x]); }vectorint G[maxn]; int st[maxn],ed[maxn];void init(){clr(st,-1);clr(ed,-1);tot0;rep(i,0,maxn) fa[i]i;rep(i,0,maxn) G[i].push_back(i); }int main() {freopen(froggy.in,r,stdin);freopen(froggy.out,w,stdout);init();scanf(%I64d%I64d,w,n);rep(i,1,n1) scanf(%I64d%I64d,pt[i].X,pt[i].Y);rep(i,1,n1){egs[tot]Edge(0,i,pt[i].X*pt[i].X);}rep(i,1,n1){egs[tot]Edge(i,n1,(w-pt[i].X)*(w-pt[i].X)); }rep(i,1,n1){rep(j,i1,n1){egs[tot]Edge(i,j,dis(pt[i].X,pt[i].Y,pt[j].X,pt[j].Y));}}egs[tot]Edge(0,n1,w*w);egs[tot]Edge(0,0,0);egs[tot]Edge(n1,n1,0);sort(egs,egstot);rep(i,0,tot){int uegs[i].u,vegs[i].v;if(u0v0){st[0]i; continue;}if(un1vn1){ed[n1]i; continue;}int pufind(u);int pvfind(v);if(pu!pv){if(find(0)pu){rep(j,0,G[pv].size()){int ttG[pv][j];st[tt]i;}}else if(find(0)pv){rep(j,0,G[pu].size()){int ttG[pu][j];st[tt]i;}}if(find(n1)pu){rep(j,0,G[pv].size()){int ttG[pv][j];ed[tt]i;}}else if(find(n1)pv){rep(j,0,G[pu].size()){int ttG[pu][j];ed[tt]i;}}fa[pv]pu;while(G[pv].size()0){G[pu].push_back(G[pv][G[pv].sz()-1]);G[pv].pop_back();}}}int ans_i0,ans_j0;double mi9000000000000000000;rep(i,0,n2){rep(j,0,n2){if(ij) continue;double tmpmax(egs[st[i]].w,egs[ed[j]].w);int tii,tjj;if(titj) swap(ti,tj);if(ti0tjn1){tmpmax(tmp,w*w*1.0/4);}else if(ti0){tmpmax(tmp,pt[tj].X*pt[tj].X*1.0/4);}else if(tjn1){tmpmax(tmp,(w-pt[ti].X)*(w-pt[ti].X)*1.0/4);}else{tmpmax(tmp,dis(pt[i].X,pt[i].Y,pt[j].X,pt[j].Y)*1.0/4);}if(tmpmi){mitmp;ans_ii; ans_jj;}}}double ans_x0,ans_y0;if(ans_ians_j) swap(ans_i,ans_j);if(ans_i0ans_jn1){ans_xw*1.0/2;ans_y0;}else if(ans_i0){ans_xpt[ans_j].X*1.0/2;ans_ypt[ans_j].Y;}else if(ans_jn1){ans_x(wpt[ans_i].X)*1.0/2;ans_ypt[ans_i].Y;}else{ans_x(pt[ans_i].Xpt[ans_j].X)*1.0/2;ans_y(pt[ans_i].Ypt[ans_j].Y)*1.0/2; }printf(%.3lf %.3lf\n,ans_x,ans_y);return 0; } 转载于:https://www.cnblogs.com/fenice/p/5769356.html
http://www.yutouwan.com/news/37266/

相关文章:

  • 免费网站建设视频教程网站维护主要是做哪些
  • 商城购物网站建设方案邯郸建移动网站费用
  • 网站分析论文建站程序
  • 网站打开403中国世界排名前100的大学
  • ftp上传网站 需要什么文件网页前端模板网站
  • 怎么建设游网站主页咸宁市做网站
  • 做电子商务网站需要什么手续科技设计公司网站模板
  • 如何做网站定位广州网站开发 找亦客公司优质
  • 怎么建设国际网站网站全站搜索代码
  • 白酒网站源码网站开发实训报告总结2021
  • 免费建立企业网站网站绑定微信公众号
  • 汉口网站建设制作网站设计工
  • 企业网站后台管理软件网站建设提案怎么写
  • 临沂市建设工程多图联审系统 网站怎么用ps做网站超链接
  • 网站开发研究背景网页设计作业文件
  • 网站建设完成确认书展会搭建设计案例网站
  • 网站建设知识论文代理游戏网站
  • 网站搭建网平面设计学徒工资一般多少
  • 古腾堡布局的网站相关网站怎么做
  • 工会 网站 建设合肥做推拉棚网站推广
  • 域名出售网站阿里云域名注册流程
  • 昌邑网站建设seo自学网视频教程
  • 创建网站开发公司服务器做网站数据库
  • 网站建设与管理ppt模板下载wordpress免费建站
  • 合肥科技职业学院网站建设与管理做app模板网站有哪些内容
  • seo查询是什么商城网站不易优化
  • 网站开发的背景知识与相关技术做p2p投资理财的网站
  • 网站的锚点链接怎么做代运营公司
  • wap网站如何建设网站建设的核心是什么
  • 长春住房和城乡建设部官方网站关于动漫的网站建设