Compare commits
No commits in common. "78c5fe402c1b8af9ffcf59279143c9c151453558" and "0ad8939399bab6aa7292a4c519655e3a28ecc63c" have entirely different histories.
78c5fe402c
...
0ad8939399
@ -5,7 +5,7 @@ https://vjudge.net/contest/508277#problem/I
|
|||||||
### 做法
|
### 做法
|
||||||
用Graham法(看PPT即按逆时针顺序找点左转入栈,右转上一个出栈直到变成是右转)求凸包,再加上一个以L为半径的⚪的周长(在转角的地方,外角和=360)
|
用Graham法(看PPT即按逆时针顺序找点左转入栈,右转上一个出栈直到变成是右转)求凸包,再加上一个以L为半径的⚪的周长(在转角的地方,外角和=360)
|
||||||
### 关键词
|
### 关键词
|
||||||
Graham、凸包、结构体、栈、PI、eps、计算几何、构造函数、
|
Graham、凸包、结构体、栈、PI、eps、计算几何
|
||||||
### 易错点
|
### 易错点
|
||||||
(int)()记得加括号、scanf与&
|
(int)()记得加括号、scanf与&
|
||||||
### 工具箱
|
### 工具箱
|
||||||
|
@ -1,83 +0,0 @@
|
|||||||
#include<iostream>
|
|
||||||
#include<cstdio>
|
|
||||||
#include<algorithm>
|
|
||||||
#include<cmath>
|
|
||||||
using namespace std;
|
|
||||||
struct Point
|
|
||||||
{
|
|
||||||
int x,y;
|
|
||||||
}p[4];
|
|
||||||
struct Edge
|
|
||||||
{
|
|
||||||
int x,y,val;
|
|
||||||
}e[4];
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
for(int i=1;i<=3;i++)
|
|
||||||
{
|
|
||||||
scanf("%d%d",&p[i].x,&p[i].y);//!!!!&
|
|
||||||
}
|
|
||||||
int sum=0;
|
|
||||||
for(int i=1;i<=3;i++)
|
|
||||||
{
|
|
||||||
int j=i%3+1;
|
|
||||||
e[i].x=p[j].x-p[i].x;
|
|
||||||
e[i].y=p[j].y-p[i].y;//i,j
|
|
||||||
e[i].val=abs(e[i].x)+abs(e[i].y);
|
|
||||||
sum+=e[i].val;
|
|
||||||
}
|
|
||||||
int ans=1;
|
|
||||||
for(int i=2;i<=3;i++)
|
|
||||||
{
|
|
||||||
if(sum-e[i].val<sum-e[ans].val)
|
|
||||||
{
|
|
||||||
ans=i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ans=ans%3+1;
|
|
||||||
int j=ans%3+1;
|
|
||||||
int tot=0;
|
|
||||||
if(e[ans].x!=0) tot++;
|
|
||||||
if(e[ans].y!=0) tot++;
|
|
||||||
if(e[j].x!=0) tot++;
|
|
||||||
if(e[j].y!=0) tot++;
|
|
||||||
if(e[j].y*e[ans].y>0)
|
|
||||||
{
|
|
||||||
tot--;
|
|
||||||
}
|
|
||||||
printf("%d\n",tot);
|
|
||||||
Point now;
|
|
||||||
now=p[ans];
|
|
||||||
if(e[ans].x!=0)
|
|
||||||
{
|
|
||||||
// if()
|
|
||||||
printf("%d %d ",now.x,now.y);
|
|
||||||
now.x+=e[ans].x;
|
|
||||||
printf("%d %d\n",now.x,now.y);
|
|
||||||
}
|
|
||||||
int been=0;
|
|
||||||
if(e[ans].y!=0)
|
|
||||||
{
|
|
||||||
printf("%d %d ",now.x,now.y);
|
|
||||||
now.y+=e[ans].y;
|
|
||||||
if(e[j].y*e[ans].y>0)
|
|
||||||
{
|
|
||||||
been=1;
|
|
||||||
now.y+=e[j].y;
|
|
||||||
}
|
|
||||||
printf("%d %d\n",now.x,now.y);
|
|
||||||
}
|
|
||||||
if(e[j].x!=0)
|
|
||||||
{
|
|
||||||
printf("%d %d ",now.x,now.y);
|
|
||||||
now.x+=e[j].x;
|
|
||||||
printf("%d %d\n",now.x,now.y);
|
|
||||||
}
|
|
||||||
if(!been&&e[j].y!=0)
|
|
||||||
{
|
|
||||||
printf("%d %d ",now.x,now.y);
|
|
||||||
now.y+=e[j].y;
|
|
||||||
printf("%d %d\n",now.x,now.y);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
@ -1,27 +0,0 @@
|
|||||||
# 题目
|
|
||||||
* 链接
|
|
||||||
### 题意
|
|
||||||
|
|
||||||
### 做法
|
|
||||||
|
|
||||||
### 关键词
|
|
||||||
|
|
||||||
### 易错点
|
|
||||||
|
|
||||||
### 工具箱
|
|
||||||
*
|
|
||||||
### 题面
|
|
||||||
|
|
||||||
### Input
|
|
||||||
|
|
||||||
### Output
|
|
||||||
|
|
||||||
### Sample
|
|
||||||
#### input
|
|
||||||
|
|
||||||
#### output
|
|
||||||
|
|
||||||
### Hint
|
|
||||||
|
|
||||||
|
|
||||||

|
|
@ -1 +0,0 @@
|
|||||||
#
|
|
@ -1,6 +0,0 @@
|
|||||||
#include <iostream>
|
|
||||||
using namespace std;
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
@ -1,7 +0,0 @@
|
|||||||
## z:\Chao\src\Template\test\in.txt
|
|
||||||
2020/03/14 ÖÜÁù 11:41:28.68
|
|
||||||
Hello Easy C++ project!
|
|
||||||
|
|
||||||
-----------------------------------------------
|
|
||||||
Process exited after 200 ms with return value 0
|
|
||||||
|
|
@ -1,27 +0,0 @@
|
|||||||
# 题目
|
|
||||||
* 链接
|
|
||||||
### 题意
|
|
||||||
|
|
||||||
### 做法
|
|
||||||
|
|
||||||
### 关键词
|
|
||||||
|
|
||||||
### 易错点
|
|
||||||
|
|
||||||
### 工具箱
|
|
||||||
*
|
|
||||||
### 题面
|
|
||||||
|
|
||||||
### Input
|
|
||||||
|
|
||||||
### Output
|
|
||||||
|
|
||||||
### Sample
|
|
||||||
#### input
|
|
||||||
|
|
||||||
#### output
|
|
||||||
|
|
||||||
### Hint
|
|
||||||
|
|
||||||
|
|
||||||

|
|
@ -1,65 +0,0 @@
|
|||||||
#include<iostream>
|
|
||||||
#include<cstdio>
|
|
||||||
#include<algorithm>
|
|
||||||
#include<cmath>
|
|
||||||
using namespace std;
|
|
||||||
const int N=1e9+5,M=4e4;//const
|
|
||||||
int ans[M],dp[3][3],t,n,len;
|
|
||||||
void pre()
|
|
||||||
{
|
|
||||||
ans[1]=0;
|
|
||||||
ans[2]=2;
|
|
||||||
ans[3]=6;
|
|
||||||
dp[0][1]=1;
|
|
||||||
dp[1][1]=1;
|
|
||||||
dp[2][1]=1;
|
|
||||||
bool b=1;
|
|
||||||
for(int i=4;b;i+=3)
|
|
||||||
{
|
|
||||||
for(int j=0;j<3;j++)
|
|
||||||
{
|
|
||||||
dp[j][1]++;
|
|
||||||
int r=(j+1)%3,l=(r+1)%3;
|
|
||||||
ans[i+j]=ans[i+j-1]+dp[l][1]*2+dp[r][1]*2;
|
|
||||||
// printf("%d:%d\n",i+j,ans[i+j]);
|
|
||||||
if(ans[i+j]>=N-5)
|
|
||||||
{
|
|
||||||
b=0;
|
|
||||||
len=i+j;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
int find(int u,int l,int r)
|
|
||||||
{
|
|
||||||
int mid=(l+r)/2;
|
|
||||||
if(l==r)
|
|
||||||
{
|
|
||||||
return l;
|
|
||||||
}
|
|
||||||
if(ans[mid]==u)
|
|
||||||
{
|
|
||||||
return mid;
|
|
||||||
}
|
|
||||||
if(u<ans[mid])
|
|
||||||
{
|
|
||||||
return find(u,l,mid);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return find(u,mid+1,r);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
// freopen("bout.txt","w",stdout);
|
|
||||||
pre();
|
|
||||||
scanf("%d",&t);
|
|
||||||
while(t--)
|
|
||||||
{
|
|
||||||
scanf("%d",&n);
|
|
||||||
printf("%d\n",find(n,1,len));
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
@ -1,4 +0,0 @@
|
|||||||
2
|
|
||||||
2
|
|
||||||
3
|
|
||||||
83
|
|
@ -1 +0,0 @@
|
|||||||
#
|
|
@ -1,6 +0,0 @@
|
|||||||
#include <iostream>
|
|
||||||
using namespace std;
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
@ -1,7 +0,0 @@
|
|||||||
## z:\Chao\src\Template\test\in.txt
|
|
||||||
2020/03/14 ÖÜÁù 11:41:28.68
|
|
||||||
Hello Easy C++ project!
|
|
||||||
|
|
||||||
-----------------------------------------------
|
|
||||||
Process exited after 200 ms with return value 0
|
|
||||||
|
|
@ -1,40 +0,0 @@
|
|||||||
#include<iostream>
|
|
||||||
#include<cstdio>
|
|
||||||
#include<algorithm>
|
|
||||||
#include<cmath>
|
|
||||||
using namespace std;
|
|
||||||
int n,m,k;
|
|
||||||
int gcd(int a,int b)
|
|
||||||
{
|
|
||||||
while(b!=0)
|
|
||||||
{
|
|
||||||
int tmp=a;
|
|
||||||
a=b;
|
|
||||||
b=tmp%b;
|
|
||||||
}
|
|
||||||
return a;
|
|
||||||
}
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
// freopen("bout.txt","w",stdout);
|
|
||||||
|
|
||||||
scanf("%d%d%d",&n,&m,&k);
|
|
||||||
int s=n*m/k*2;
|
|
||||||
if(n*m*2%k!=0)
|
|
||||||
{
|
|
||||||
printf("NO");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
int nm=gcd(n,m),n1=n/nm,m1=m/nm;
|
|
||||||
int x=gcd(k,n1),xy=gcd(k,nm),y=gcd(k,m1);
|
|
||||||
printf("%d %d %d %d\n",nm,x,y,xy);
|
|
||||||
if(gcd(x*y*xy,s)==s)
|
|
||||||
{
|
|
||||||
printf("YES\n0 0\n%d 0\n0 %d\n",x*xy,y);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
printf("NO");
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
@ -1,46 +0,0 @@
|
|||||||
#include<iostream>
|
|
||||||
#include<cstdio>
|
|
||||||
#include<algorithm>
|
|
||||||
#include<cmath>
|
|
||||||
using namespace std;
|
|
||||||
int n,m,k;
|
|
||||||
int s,d,x;
|
|
||||||
|
|
||||||
int baoli()
|
|
||||||
{
|
|
||||||
int len=sqrt(s);
|
|
||||||
for(int i=1;i<=len;i++)
|
|
||||||
{
|
|
||||||
if(s%i==0)
|
|
||||||
{
|
|
||||||
if(x>=i&&d>=s/i)
|
|
||||||
{
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
scanf("%d%d%d",&n,&m,&k);
|
|
||||||
s=n*m/k*2;
|
|
||||||
d=m>n? m:n,x=m<n? m:n;
|
|
||||||
if(n*m*2%k!=0)
|
|
||||||
{
|
|
||||||
printf("NO");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
int i=baoli();
|
|
||||||
// printf("%d %d",d,x);
|
|
||||||
if(i>0)
|
|
||||||
{
|
|
||||||
if(x==n)printf("YES\n0 0\n%d 0\n0 %d",i,s/i);
|
|
||||||
else printf("YES\n0 0\n%d 0\n0 %d",s/i,i);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
printf("NO");
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
@ -1,27 +0,0 @@
|
|||||||
# 题目
|
|
||||||
* 链接
|
|
||||||
### 题意
|
|
||||||
|
|
||||||
### 做法
|
|
||||||
|
|
||||||
### 关键词
|
|
||||||
|
|
||||||
### 易错点
|
|
||||||
|
|
||||||
### 工具箱
|
|
||||||
*
|
|
||||||
### 题面
|
|
||||||
|
|
||||||
### Input
|
|
||||||
|
|
||||||
### Output
|
|
||||||
|
|
||||||
### Sample
|
|
||||||
#### input
|
|
||||||
|
|
||||||
#### output
|
|
||||||
|
|
||||||
### Hint
|
|
||||||
|
|
||||||
|
|
||||||

|
|
@ -1 +0,0 @@
|
|||||||
#
|
|
@ -1,6 +0,0 @@
|
|||||||
#include <iostream>
|
|
||||||
using namespace std;
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
@ -1,7 +0,0 @@
|
|||||||
## z:\Chao\src\Template\test\in.txt
|
|
||||||
2020/03/14 ÖÜÁù 11:41:28.68
|
|
||||||
Hello Easy C++ project!
|
|
||||||
|
|
||||||
-----------------------------------------------
|
|
||||||
Process exited after 200 ms with return value 0
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user