8.13早上比赛

This commit is contained in:
ljcjames 2022-08-13 14:22:41 +08:00
parent 0ad8939399
commit 65b6b8310f
26 changed files with 316 additions and 1 deletions

View File

@ -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与&
### 工具箱 ### 工具箱

83
8.13/A-Points/Points.cpp Normal file
View File

@ -0,0 +1,83 @@
#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;
}

27
8.13/A-Points/Readme.md Normal file
View File

@ -0,0 +1,27 @@
# 题目
* 链接
### 题意
### 做法
### 关键词
### 易错点
### 工具箱
*
### 题面
### Input
### Output
### Sample
#### input
#### output
### Hint
![](sketch.jpg)

View File

@ -0,0 +1 @@
#

6
8.13/A-Points/main.cpp Normal file
View File

@ -0,0 +1,6 @@
#include <iostream>
using namespace std;
int main()
{
}

View File

View File

View File

View File

@ -0,0 +1,7 @@
## 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

View File

@ -0,0 +1,27 @@
# 题目
* 链接
### 题意
### 做法
### 关键词
### 易错点
### 工具箱
*
### 题面
### Input
### Output
### Sample
#### input
#### output
### Hint
![](sketch.jpg)

View File

@ -0,0 +1,65 @@
#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;
}

View File

@ -0,0 +1,4 @@
2
2
3
83

View File

@ -0,0 +1 @@
#

View File

@ -0,0 +1,6 @@
#include <iostream>
using namespace std;
int main()
{
}

View File

View File

View File

View File

@ -0,0 +1,7 @@
## 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

View File

@ -0,0 +1,40 @@
#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;
}

View File

@ -0,0 +1,27 @@
# 题目
* 链接
### 题意
### 做法
### 关键词
### 易错点
### 工具箱
*
### 题面
### Input
### Output
### Sample
#### input
#### output
### Hint
![](sketch.jpg)

View File

@ -0,0 +1 @@
#

View File

@ -0,0 +1,6 @@
#include <iostream>
using namespace std;
int main()
{
}

View File

View File

View File

View File

@ -0,0 +1,7 @@
## 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