HDU 1700 Points on Cycle(向量旋转)
水题,卡了下下精度。
#include <cstdio>
#include <iostream>
#include <cmath>
using namespace std ;
#define PI acos(-1.0)
#define eps 1e-8
int judge(double x,double y)
{
double a;
a = x-y;
if(a < )
a = -a;
if(a < eps)
return ;
else
return ;
}
int main()
{
double x,y,lx,rx,ly,ry,a;
int t;
scanf("%d",&t);
while(t--)
{
scanf("%lf%lf",&x,&y);
a = PI/*;
lx=x*cos(a)-y*sin(a);
ly=x*sin(a)+y*cos(a);
rx=x*cos(a)+y*sin(a);
ry=-x*sin(a)+y*cos(a);
if(ly - ry > eps)
{
swap(ly,ry);
swap(lx,rx);
}
else if(judge(ly,ry))
{
if(lx - rx > eps)
{
swap(ly,ry);
swap(lx,rx);
}
}
printf("%.3lf %.3lf %.3lf %.3lf\n",lx,ly,rx,ry);
}
return ;
}
HDU 1700 Points on Cycle(向量旋转)的更多相关文章
- HDU 1700 Points on Cycle (坐标旋转)
题目链接:HDU 1700 Problem Description There is a cycle with its center on the origin. Now give you a poi ...
- hdu 1700 Points on Cycle(坐标旋转)
http://acm.hdu.edu.cn/showproblem.php?pid=1700 Points on Cycle Time Limit: 1000/1000 MS (Java/Others ...
- HDU 1700 Points on Cycle (几何 向量旋转)
http://acm.hdu.edu.cn/showproblem.php?pid=1700 题目大意: 二维平面,一个圆的圆心在原点上.给定圆上的一点A,求另外两点B,C,B.C在圆上,并且三角形A ...
- hdu 1700 Points on Cycle 水几何
已知圆心(0,0)圆周上的一点,求圆周上另外两点使得三点构成等边三角形. 懒得推公式,直接用模板2圆(r1=dist,r2=sqrt(3)*dist)相交水过 #include<cstdio&g ...
- Points on Cycle (hdu1700,几何)
Points on Cycle Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) ...
- hdu1700 Points on Cycle
地址:http://acm.split.hdu.edu.cn/showproblem.php?pid=1700 题目: Points on Cycle Time Limit: 1000/1000 MS ...
- Points on cycle
Description There is a cycle with its center on the origin. Now give you a point on the cycle, you a ...
- HDU-1700 Points on Cycle
这题的俩种方法都是看别人的代码,方法可以学习学习,要多看看.. 几何题用到向量.. Points on Cycle Time Limit: 1000/1000 MS (Java/Others) ...
- sdut 2603:Rescue The Princess(第四届山东省省赛原题,计算几何,向量旋转 + 向量交点)
Rescue The Princess Time Limit: 1000ms Memory limit: 65536K 有疑问?点这里^_^ 题目描述 Several days ago, a b ...
随机推荐
- forEach 方法 (Array) (JavaScript)
为数组中的每个元素执行指定操作. 语法 array1.forEach(callbackfn[, thisArg]) 参数 参数 定义 array1 必选.一个数组对象. callbackfn 必选.最 ...
- LightOJ 1030 Discovering Gold(期望 概率)
正推,到达i的概率为p[i],要注意除了1和n外,到达i的概率并不一定为1 概率表达式为p[i] += p[j] / min(n - j, 6) 从j带过来的期望为exp[i] += exp[j] / ...
- ASMCMD命令
安装好用的rlwrap工具,在环境变量里添加如下,就能实现显示当前路径(目录),目录补全的方便功能 alias asmcmd='rlwrap -r -i asmcmd –p' asmcmd>he ...
- HP SAN Switch光纖交換機命令行畫zone
有時候我們無法登陸網頁交互界面去操縱交換機,如下提供了命令行方式從交換機劃zone 1.創建別名 alicreate "SummaryDB_N", "211,14; 21 ...
- [JAVA] IOException: Invalid byte 2 of 2-byte UTF-8 sequence(解决办法)
日志打印不全,后台只打印出出标题的异常信息: 先前的日志打印信息:log.debug(e.getMessage()); 后面改成了日志打印信息:log.debug(e); log.debug(e.ge ...
- 免费电子书:C#代码整洁之道
(此文章同时发表在本人微信公众号"dotNET每日精华文章",欢迎右边二维码来关注.) 题记:<Clean Code(代码整洁之道)>是一本经典的著作,那么对于编写整洁 ...
- 在Visualforce page中用自带的控件实现Ajax回调后台方法(并且可以用js去动态给parameters赋值)
这里用的组合是:apex:commandLink + apex:actionFunction + apex:outputPanel 这里的 apex:commandLink 和 apex:actio ...
- 利用canvas实现抽奖转盘---转载别人的
功能需求 转盘要美观,转动效果流畅. 转盘上需要显示奖品图片,并且奖品是后台读取的照片和名字. 转动动画完成后要有相应提示. 获取的奖品具体算法在数据库里操作,前端只提供最后的效果展示. 知识要点 ...
- Android自动化压力测试之Monkey Test (三)
Monkey 是什么? Monkey是Google提供的一个用于稳定性与压力测试的命令行工具. Monkey路径: 路径:/System/framework/monkey.jar 启动脚本路径:/sy ...
- c语言二维数组传递
c语言二维数组传递,目前我总结三种方法,以及纠正一个不能使用的方法 /********************************* * 方法1: 第一维的长度可以不指定 * * 但必须指定第二维 ...