当前位置:网站首页>码蹄集 精准弹幕
码蹄集 精准弹幕
2022-07-25 22:47:00 【Elvin域文】
这里边比较关键的就是对斜率和角度的处理
具体怎么使用查看下面这条链接
cos()_C语言cos()详解:余弦函数,求某个角的余弦值 (biancheng.net)
#include<bits/stdc++.h>
using namespace std;
#define PI 3.14159265
int main( )
{
double x,y,r,xt,yt;
double k;
cin >> x >> y >> r >> k >> xt >> yt;
double y1,x1, y2, x2;
double a;
a = atan(k)*180/PI;
a = 90.0-a;
if(k>0){
x1 = x+r*cos(a*PI/180);
y1 = y-r*sin(a*PI/180);
x2 = x-r*cos(a*PI/180);
y1 = y+r*sin(a*PI/180);
y1 = k*(xt-x1)+y1;
y2 = k*(xt-x2)+y2;
if((y1<=yt and y2>=yt) or(y1>=yt and y2<=yt)){
cout << 1;
}
else{
cout << 0;
}
}
if(k<0){
x1 = x-r*cos(a*PI/180);
y1 = y-r*sin(a*PI/180);
x2 = x+r*cos(a*PI/180);
y2 = y+r*sin(a*PI/180);
y1 = k*(xt-x1)+y1;
y2 = k*(xt-x2)+y2;
if((y1<=yt and y2>=yt) or (y1>=yt and y2<=yt)){
cout << 1;
}
else{
cout << 0;
}
}
if(k==0) {
if(yt>=y-r and yt <=y+r){
cout << 1;
}
else{
cout << 0;
}
}
return 0;
}边栏推荐
- 【集训DAY15】Boring【树形DP】
- Mocha test
- MySQL data type
- Vodak software: Smart City solution
- Learning orientation today
- Session and cookie, token and storage
- Von Neumann architecture
- Understanding of forward proxy and reverse proxy
- Can generic types be used in array
- Today, I sorted out some problems about high collapse
猜你喜欢
![[training Day12] min ratio [DFS] [minimum spanning tree]](/img/f8/e37efd0d2aa0b3d79484b9ac42b7eb.png)
[training Day12] min ratio [DFS] [minimum spanning tree]

Day006 select structure (if statement exercise)

Qt5.12 installation error prompt: c:\qt5.12.11\vcredist\vcredist_ msvc2019_ x86.exe /norestart /q

Summary 1 - deep learning - basic knowledge learning

【集训DAY15】Boring【树形DP】

The new media operation strategy (taking xiaohongshu as an example) helps you quickly master the creative method of popular models

HCIE终到手,路才开始

【集训DAY15】油漆道路【最小生成树】

【集训DAY12】X equation 【高精度】【数学】

Multi data source switching
随机推荐
Express framework
[training day15] paint road [minimum spanning tree]
【集训DAY13】Backpack【动态规划】【贪心】
力扣解法汇总919-完全二叉树插入器
Examples and points for attention about the use of getchar and scanf
Day006 select structure (if statement exercise)
Platform architecture construction
The new media operation strategy (taking xiaohongshu as an example) helps you quickly master the creative method of popular models
We media people must have four resource tools, each of which is very practical
recyclerview计算滑动距离之computeHorizontalScrollExtent-computeHorizontalScrollRange-computeHorizontalScrol
[training day15] good name [hash]
JD quick navigation box
3 词法分析
Qt5.12 installation error prompt: c:\qt5.12.11\vcredist\vcredist_ msvc2019_ x86.exe /norestart /q
Binder principle
xss-工具-Beef-Xss安装以及使用
Box model (2)
Why is Google's internal tools not suitable for you?
Deep recursion, deep search DFS, backtracking, paper cutting learning.
【PMP学习笔记】第1章 PMP体系引论