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 ...
随机推荐
- python 使用eval() 可以将json格式的数据,转换为原始数据
使用python 自带的函数可以将json 格式的数据(也就是字符串)转换为原始格式的数据, 当使用json.loads()无法将json格式的数据转换为原始数据(存在多层各种格式类型数据的嵌套), ...
- 【FAQ】Maven 本地仓库明明有jar包,pom文件还是报错解决办法
方法一: 找到出错的jar包文件位置,删掉_maven.repositories文件 方法二: maven中的本地仓库的index索引没有更新导致 解决方案: 在eclipse中打开菜单 window ...
- FFmpeg工具使用总结
. 一. FFmpeg是什么? 简单说,FFmpeg就是一个很好的,免费的,开源的视频转换工具.详细说,FFmpeg是一个开源免费跨平台的视频和音频流方案,属于自由软件,采用LGPL或GPL许可证(依 ...
- java_I/O字节流
I/O流(Stream) INPUT:输入流,从文件里读OUPUT:输出流,写内容到文件 IO流分为:字符流和字节流 字符流:处理纯文本文件. 字节流:处理可以所有文件. 测试字节输出流OuPut(写 ...
- C#-WebForm-LinQ-条件精确查询、高级查询
前台界面,并在后台绑定数据 <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Ca ...
- 前端JS批量添加校验数据唯一性
<script type="text/javascript"> //维护删除数组中的某一项 Array.prototype.remove = function(val) ...
- 并发编程>>并发级别(二)
理解并发 这是我在开发者头条看到的.@编程原理林振华 有目标的提升自己会事半功倍,前行的道路并不孤独. 1.阻塞 当一个线程进入临界区(公共资源区)后,其他线程必须在临界区外等待,待进去的线程执行完成 ...
- pycharm+gitee
Git操作 前言: 由于各种原因,很多时候我们写代码的电脑并不会随身携带,所以有的时候突发灵感想继续写代码就变得难以实现.相信大部分同学对此都有了解,那就通过代码托管平台来管理.原本想用GitHub来 ...
- 我也学习JAVA多线程-join
在工作中,挺少遇到join关键字,但很多多线程资料和面试过程中,初中级开发工程师总会遇到join. 今天一起学习下join. join的作用:等待指定的时间(当为0时,一直等待),直到这个线程执行结束 ...
- springcloud(五)-Ribbon
前言 先发句牢骚,最近太TM忙了,一直没时间静下心来继续写微服务架构!EMMMMMM..... 经过前文的讲解,我们已经实现了微服务的注册与发现.启动各个微服务时,Eureka Client会把自己的 ...