Robot Race UVALive
来源:互联网 发布:tensorflow 英文教程 编辑:程序博客网 时间:2024/06/07 15:34
这个题就是让你去判断三点是否能够成锐角,然后确定相邻的两个点,枚举另外一个点,然后直接用点乘判断一下是否有锐角,如果有锐角输出unfair 否则输出fair
#include <iostream>#include <cstdio>#include <cstring>#include <cstdlib>#include <algorithm>#include <vector>#include <map>#include <queue>#include <math.h>#include <stack>#include <utility>#include <string>#include <sstream>#include <cstdlib>#define LL long longusing namespace std;const int INF = 0x3f3f3f3f;const int maxn = 10000 + 10;int dir[4][2] = {{1,0},{0,1},{-1,0},{0,-1}};struct point{ LL x;LL y;} p[maxn];bool judge(point a,point b,point c){ if((a.x - b.x)*(c.x - b.x) + (a.y - b.y)*(c.y - b.y) <= 0) return true; return false;}int main(){ int n; while(scanf("%d",&n) && n) { for(int i = 0; i < n; i++) { scanf("%lld%lld",&p[i].x,&p[i].y); } int flag = 0; for(int i = 0; i < n - 2; i++) { for(int j = i + 2; j < n; j++) { if(!judge(p[i],p[i+1],p[j])) { flag = 1; break; } } if(flag) break; } if(flag) cout<<"Unfair"<<endl; else cout<<"Fair"<<endl; }}
阅读全文
1 0
- Robot Race UVALive
- Robot Race UVALive
- UVALive 5738 Robot Navigation
- UVALive 7608Robot(模拟)
- UVAlive 5866 Robot Arm Planning 题解
- Maze For Robot - UVaLive 4040 dp
- Race
- Robot
- robot
- robot
- Robot
- Robot
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- UVALive
- js for循环
- 自定义可折叠textview
- 如何利用示波器测量电源纹波
- liunx 关闭开启防火墙
- 命令行操作jar,文件写入中文乱码处理
- Robot Race UVALive
- SDK及API介绍
- stl-stack/queue/list
- SRM帮你轻松询报价,全面降低采购成本!
- c++回调机制全解:定义原型,注册,回调,封装.
- [linux]ubuntu下进行texlive+texstudio+xeCJK中文环境安装
- mysql 日期时间有关的函数
- Spring AOP和事务处理的自我总结
- 浅谈分布式消息技术 Kafka