bnu 10783 格斗游戏 线段与圆的关系
格斗游戏
None
Graph Theory
2-SAT
Articulation/Bridge/Biconnected Component
Cycles/Topological Sorting/Strongly Connected Component
Shortest Path
Bellman Ford
Dijkstra/Floyd Warshall
Euler Trail/Circuit
Heavy-Light Decomposition
Minimum Spanning Tree
Stable Marriage Problem
Trees
Directed Minimum Spanning Tree
Flow/Matching
Graph Matching
Bipartite Matching
Hopcroft–Karp Bipartite Matching
Weighted Bipartite Matching/Hungarian Algorithm
Flow
Max Flow/Min Cut
Min Cost Max Flow
DFS-like
Backtracking with Pruning/Branch and Bound
Basic Recursion
IDA* Search
Parsing/Grammar
Breadth First Search/Depth First Search
Advanced Search Techniques
Binary Search/Bisection
Ternary Search
Geometry
Basic Geometry
Computational Geometry
Convex Hull
Pick's Theorem
Game Theory
Green Hackenbush/Colon Principle/Fusion Principle
Nim
Sprague-Grundy Number
Matrix
Gaussian Elimination
Matrix Exponentiation
Data Structures
Basic Data Structures
Binary Indexed Tree
Binary Search Tree
Hashing
Orthogonal Range Search
Range Minimum Query/Lowest Common Ancestor
Segment Tree/Interval Tree
Trie Tree
Sorting
Disjoint Set
String
Aho Corasick
Knuth-Morris-Pratt
Suffix Array/Suffix Tree
Math
Basic Math
Big Integer Arithmetic
Number Theory
Chinese Remainder Theorem
Extended Euclid
Inclusion/Exclusion
Modular Arithmetic
Combinatorics
Group Theory/Burnside's lemma
Counting
Probability/Expected Value
Others
Tricky
Hardest
Unusual
Brute Force
Implementation
Constructive Algorithms
Two Pointer
Bitmask
Beginner
Discrete Logarithm/Shank's Baby-step Giant-step Algorithm
Greedy
Divide and Conquer
Dynamic Programming
Tag it!
Input
Output
Sample Input
3
0 0 1
0 0 0 1
0 0 1
0 0 1 1
0 0 1
1 0 1 1
Sample Output
ALL IN
PART IN
ALL OUT
Source
Author
#include <iostream>
#include <cstdio>
#include <cstdlib>
using namespace std; int dist2 (int x1, int y1, int x2, int y2)
{
return (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1);
} int pointPro (int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4)
{
return (x2 - x1) * (x4 - x3) + (y2 - y1) * (y4 - y3);
} int work (int x0, int y0, int r, int x1, int y1, int x2, int y2)//圆坐标和半径,线段的两个端点
{
int A, B, C, OA2, OB2, R2;
A = y2 - y1;
B = x1 - x2;
C = x2 * y1 - x1 * y2;
R2 = r * r;
if ((A * x0 + B * y0 + C) * (A * x0 + B * y0 + C) >= R2 * (A * A + B * B))
return ;//没有严格在里面 (圆外)
OA2 = dist2 (x0, y0, x1, y1);
OB2 = dist2 (x0, y0, x2, y2);
if (OA2 <= R2 && OB2 <= R2)
return -;//没有严格在外面 (圆内)
if (OA2 > R2 && OB2 < R2 || OA2 < R2 && OB2 > R2)
return ;
if (pointPro (x0, y0, x1, y1, x1, y1, x2, y2) * pointPro (x0, y0, x2, y2, x2, y2, x1, y1) < )
return ;
else
return ;
} int main()
{
int t;
int cx,cy,r,x1,x2,y1,y2;
while(scanf("%d",&t)>)
{
while(t--)
{
scanf("%d%d%d",&cx,&cy,&r);
scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
int hxl=work(cx,cy,r,x1,y1,x2,y2);
if(hxl==) printf("ALL OUT\n");
else if(hxl==-) printf ("ALL IN\n");
else printf ("PART IN\n");
}
}
return ;
}
bnu 10783 格斗游戏 线段与圆的关系的更多相关文章
- 《Genesis-3D开源游戏引擎--横版格斗游戏制作教程:简介及目录》(附上完整工程文件)
介绍:讲述如何使用Genesis-3D来制作一个横版格斗游戏,涉及如何制作连招系统,如何使用包围盒实现碰撞检测,软键盘的制作,场景切换,技能读表,简单怪物AI等等,并为您提供这个框架的全套资源,源码以 ...
- HDU 4063 线段与圆相交+最短路
Aircraft Time Limit: 10000/3000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total ...
- Beat 'Em Up Game Starter Kit (横版格斗游戏) cocos2d-x游戏源代码
浓缩精华.专注战斗! 游戏的本质是什么?界面?养成?NoNo! 游戏来源于对实战和比赛的模拟,所以它的本源就是对抗.就是战斗! 是挥洒热血的一种方式! 一个游戏最复杂最难做的是什么?UI?商城? ...
- 都闪开,不用任何游戏引擎,html也能开发格斗游戏
html格斗游戏,对打游戏 不用引擎,不用画布canvas,不用任何库(包括jquery), 原生div+img组件,开发格斗游戏游戏教程视频已经上传 b站:https://www.bilibili. ...
- C++第13周(春)项目1 - 点、圆的关系
课程首页在:http://blog.csdn.net/sxhelijian/article/details/11890759.内有完整教学方案及资源链接 [项目1 - 点.圆的关系](1)先建立一个P ...
- C++ 2(将类分文件) //点和圆的关系 //设计一个圆形类 和一个点类 计算点和圆的关系 //点到圆心的距离 == 半径 点在圆上 //点到圆心的距离 > 半径 点在圆外 //点到圆心的距离 < 半径 点在圆内 //点到圆心的距离 获取 ....... (x1 -x2)^2 + (y1-y2)^2 开根号 和半径对比 // 计算 可以 两边同时 平方
1 源文件 main.cpp 2 //点和圆的关系 3 //设计一个圆形类 和一个点类 计算点和圆的关系 4 //点到圆心的距离 == 半径 点在圆上 5 //点到圆心的距离 > 半径 点在圆外 ...
- C++ 1 (只在源文件)//点和圆的关系 //设计一个圆形类 和一个点类 计算点和圆的关系 //点到圆心的距离 == 半径 点在圆上 //点到圆心的距离 > 半径 点在圆外 //点到圆心的距离 < 半径 点在圆内 //点到圆心的距离 获取 ....... (x1 -x2)^2 + (y1-y2)^2 开根号 和半径对比 // 计算 可以 两边同时 平方
1 //点和圆的关系 2 //设计一个圆形类 和一个点类 计算点和圆的关系 3 //点到圆心的距离 == 半径 点在圆上 4 //点到圆心的距离 > 半径 点在圆外 5 //点到圆心的距离 &l ...
- BNU 2418 Ultra-QuickSort (线段树求逆序对)
题目链接:http://acm.bnu.edu.cn/bnuoj/problem_show.php?pid=2418 解题报告:就是给你n个数,然后让你求这个数列的逆序对是多少?题目中n的范围是n & ...
- bnu 51636 Squared Permutation 线段树
Squared Permutation Time Limit: 6000ms Memory Limit: 262144KB 64-bit integer IO format: %lld Ja ...
随机推荐
- 爬虫3:requests库
一个简单易用的http库,多用于第一步,爬取网站源码 简单例子 import requests response = requests.get('https://www.baidu.com ...
- 【python】10分钟教你用python打造贪吃蛇超详细教程
10分钟教你用python打造贪吃蛇超详细教程 在家闲着没妹子约, 刚好最近又学了一下python,听说pygame挺好玩的.今天就在家研究一下, 弄了个贪吃蛇出来.希望大家喜欢. 先看程序效果: 0 ...
- FlowPortal-BPM——文件目录功能
安装目录文件夹:Attachments 附件bin Bin目录:dll文件的引用DataSourceProviders 固定的数据库连接文件ExtServer 数据源服务FormService 表单服 ...
- ReactNative常用组件库 victory-native 图表
victory-native 是不错的图表组件,支持很多种图表 地址: https://github.com/FormidableLabs/victory-native 先安装 react-nativ ...
- nodejs(四) --- cluster模块详解
什么是cluster模块,为什么需要cluster模块? cluster在英文中有集.群的意思. nodejs默认是单进程的,但是对于多核的cpu来说, 单进程显然没有充分利用cpu,所以,node ...
- React之表单
第一部分:表单基础 在React中,修改表单的唯一途径是使用setState方法.举例如下: class NameForm extends React.Component { constructor( ...
- java中的POJO、PO、VO分别是什么?
1.PO:persistant object 持久对象 可以看成是与数据库中的表相映射的java对象.使用Hibernate来生成PO是不错的选择. 2. VO:value object值对象. 通常 ...
- javascript中Function与Object
1. 先来一段代码: console.log(Function); // function Function() { [native code] } console.log(Object); // f ...
- JDBC处理可滚动的处理集
Statement createStatement(int resultSetType, int resultSetConcurrency, ...
- eclips中maven解决jsp报错的问题
加入如下的pom依赖: <!-- 解决jsp报错的依赖包第一个 --> <dependency> <groupId>javax.servlet</groupI ...