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

可以做网站的服务器/网络推广方法的分类

可以做网站的服务器,网络推广方法的分类,开源门户网站源码,网站建设利润越来越低计算几何/旋转卡壳 学习旋转卡壳请戳这里~感觉讲的最好的就是这个了…… 其实就是找面积最大的三角形?。。。并且满足单调…… 嗯反正就是这样…… 这是一道模板题 好像必须写成循环访问?我在原数组后面复制了一遍点,结果挂了……改成curcur%…

计算几何/旋转卡壳


  学习旋转卡壳请戳这里~感觉讲的最好的就是这个了……

  其实就是找面积最大的三角形?。。。并且满足单调……

  嗯反正就是这样……

  这是一道模板题

 

  好像必须写成循环访问?我在原数组后面复制了一遍点,结果挂了……改成cur=cur%n+1就过了QAQ

//其实是不是数组没开够所以复制的方法就爆了?

UPD:(2015年5月13日 20:40:45)

  其实是我点保存在1~n里面,所以复制的时候不能写p[i+n-1]=p[i]; 而应该是p[i+n]=p[i];……QAQ我是傻逼

 1 Source Code
 2 Problem: 2187        User: sdfzyhy
 3 Memory: 1044K        Time: 32MS
 4 Language: G++        Result: Accepted
 5 
 6     Source Code
 7 
 8     //POJ 2187
 9     #include<cstdio>
10     #include<cstring>
11     #include<cstdlib>
12     #include<iostream>
13     #include<algorithm>
14     #define rep(i,n) for(int i=0;i<n;++i)
15     #define F(i,j,n) for(int i=j;i<=n;++i)
16     #define D(i,j,n) for(int i=j;i>=n;--i)
17     #define pb push_back
18     using namespace std;
19     typedef long long LL;
20     inline int getint(){
21         int r=1,v=0; char ch=getchar();
22         for(;!isdigit(ch);ch=getchar()) if (ch=='-') r=-1;
23         for(; isdigit(ch);ch=getchar()) v=v*10-'0'+ch;
24         return r*v;
25     }
26     const int N=100010;
27     /*******************template********************/
28     struct Poi{
29         int x,y;
30         Poi(){}
31         Poi(int x,int y):x(x),y(y){}
32         void read(){x=getint();y=getint();}
33     }p[N],ch[N];
34     typedef Poi Vec;
35     Vec operator - (const Poi &a,const Poi &b){return Vec(a.x-b.x,a.y-b.y);}
36     bool operator < (const Poi &a,const Poi &b){return a.x<b.x || (a.x==b.x && a.y<b.y);}
37     inline int Cross(const Poi &a,const Poi &b){return a.x*b.y-a.y*b.x;}
38     inline int Dot(const Poi &a,const Poi &b){return a.x*b.x+a.y*b.y;}
39     int n,m,ans;
40 
41     void graham(Poi *p,int n){
42         int size=0;
43         sort(p+1,p+n+1);
44         ch[++m]=p[1];
45         F(i,2,n){
46             while(m>1 && Cross(ch[m]-ch[m-1],p[i]-ch[m-1])<=0) m--;
47             ch[++m]=p[i];
48         }
49         int k=m;
50         D(i,n-1,1){
51             while(m>k && Cross(ch[m]-ch[m-1],p[i]-ch[m-1])<=0) m--;
52             ch[++m]=p[i];
53         }
54         if (n>1) m--;
55     }
56 
57     void rot(Poi *p,int n){
58         ans=0;
59     //    F(i,1,n-1) p[n+i-1]=p[i];
60     //    n=n*2-1;
61         int cur=2;
62         F(i,1,n){
63             Vec v = p[i]-p[i+1];
64             while(Cross(p[i+1]-p[i],p[cur+1]-p[i]) > Cross(p[i+1]-p[i],p[cur]-p[i]))
65                 cur=(cur%n)+1;
66             ans=max(ans,Dot(p[cur]-p[i],p[cur]-p[i]));
67             ans=max(ans,Dot(p[cur+1]-p[i+1],p[cur+1]-p[i+1]));
68         }
69     }
70                 
71     int main(){
72     #ifndef ONLINE_JUDGE
73         freopen("2187.in","r",stdin);
74     //    freopen("2187.out","w",stdout);
75     #endif
76         n=getint();
77         F(i,1,n) p[i].read();
78         graham(p,n);
79         rot(ch,m);
80         printf("%d\n",ans);
81         return 0;
82     }
View Code
Beauty Contest
Time Limit: 3000MS Memory Limit: 65536K
Total Submissions: 29879 Accepted: 9260

Description

Bessie, Farmer John's prize cow, has just won first place in a bovine beauty contest, earning the title 'Miss Cow World'. As a result, Bessie will make a tour of N (2 <= N <= 50,000) farms around the world in order to spread goodwill between farmers and their cows. For simplicity, the world will be represented as a two-dimensional plane, where each farm is located at a pair of integer coordinates (x,y), each having a value in the range -10,000 ... 10,000. No two farms share the same pair of coordinates.

Even though Bessie travels directly in a straight line between pairs of farms, the distance between some farms can be quite large, so she wants to bring a suitcase full of hay with her so she has enough food to eat on each leg of her journey. Since Bessie refills her suitcase at every farm she visits, she wants to determine the maximum possible distance she might need to travel so she knows the size of suitcase she must bring.Help Bessie by computing the maximum distance among all pairs of farms.

Input

* Line 1: A single integer, N

* Lines 2..N+1: Two space-separated integers x and y specifying coordinate of each farm

Output

* Line 1: A single integer that is the squared distance between the pair of farms that are farthest apart from each other.

Sample Input

4
0 0
0 1
1 1
1 0

Sample Output

2

Hint

Farm 1 (0, 0) and farm 3 (1, 1) have the longest distance (square root of 2)

Source

USACO 2003 Fall

[Submit]   [Go Back]   [Status]   [Discuss]

转载于:https://www.cnblogs.com/Tunix/p/4500730.html

http://www.jmfq.cn/news/5234293.html

相关文章:

  • 如何查看网站做没做301跳转/如何用模板做网站
  • 好的建设网站/域名被墙查询检测
  • wordpress 图片 不显示缩略图/天津搜索引擎优化
  • 做视频的音乐哪里下载网站/网站seo策划
  • 做民宿推广都有哪些网站/手机优化大师
  • 企业网站建设设计公司/谷歌浏览器下载手机版
  • 网站建设软件培训学校/如何优化网页加载速度
  • 网站兼容ie代码/宁德市蕉城区疫情
  • 智能开关网站开发具体流程/百度seo关键词排名价格
  • 做网站个体户经营范围/武汉网络推广广告公司
  • 网站建设 知乎/湘潭高新区最新新闻
  • 中国建设银行国际互联网站/网站优化公司排名
  • 浏阳网站定制/百度网
  • 东营的网站建设公司/免费打广告网站
  • 用dw怎么做网站后台/潍坊网站建设优化
  • 在网站添加邮箱/seo关键词优化推广外包
  • 专业网站建设哪里有/建站之星
  • 网站建设 java/做什么推广最赚钱
  • 假如做网站推广如何推广/网站注册地址
  • 郑州网站建设咨询/百度怎么优化关键词排名
  • 媒体发稿网站开发/搜索引擎优化的实验结果分析
  • 东莞网站系统后缀/谷歌浏览器app下载安装
  • 提供网站建设课程设计/竞价推广怎么做
  • 基于php mysql的网站开发/河南网站seo靠谱
  • 网站建设不完整(网站内容太少)/商丘seo博客
  • 织梦做动漫网站/开网店怎么推广运营
  • 一台云服务器可以做多个网站/网络营销价格策略有哪些
  • 求个网站你懂我的意思2021/重庆seo排名优化
  • 山东网站建设最便宜/seo网站关键词排名快速
  • 龙岗做网站的公司/扬州网络推广哪家好