L - Points on Cycle

Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u

Description

There is a cycle with its center on the origin. 
Now give you a point on the cycle, you are to find out the other two points on it, to maximize the sum of the distance between each other 
you may assume that the radius of the cycle will not exceed 1000.
 

Input

There are T test cases, in each case there are 2 decimal number representing the coordinate of the given point.
 

Output

For each testcase you are supposed to output the coordinates of both of the unknow points by 3 decimal places of precision 
Alway output the lower one first(with a smaller Y-coordinate value), if they have the same Y value output the one with a smaller X.

NOTE

when output, if the absolute difference between the coordinate values X1 and X2 is smaller than 0.0005, we assume they are equal.

 

Sample Input

2
1.500 2.000
563.585 1.251
 

Sample Output

0.982 -2.299 -2.482 0.299
-280.709 -488.704 -282.876 487.453
 
 
//题目意思,在一个圆心在原点的圆上,给你一个点的坐标,求圆内接正三角形的另两个点坐标
 
//这周做题真的很蛋疼,什么都一次过不了,什么奇奇怪怪的错误都有。
这题用旋转公式,弧度传4*pi/3 ,竟然是错的,必须传-2*pi/3,真是不懂,好烦!!!
 
 
 #include <iostream>
#include <stdio.h>
#include <math.h>
using namespace std; const double pi=3.141592654; int main()
{
int t;
scanf("%d",&t);
double x,y;
double x1,y1,x2,y2;
while (t--)
{
scanf("%lf%lf",&x,&y);
x1=x*cos(*pi/)-y*sin(*pi/);
y1=x*sin(*pi/)+y*cos(*pi/);
x2=x*cos(-*pi/)-y*sin(-*pi/);
y2=x*sin(-*pi/)+y*cos(-*pi/); if (y1<y2||(y1==y2&&x1<x2))//题目要求,y值小的在前面,y一样x小的在前面
printf("%.3lf %.3lf %.3lf %.3lf\n",x1,y1,x2,y2);
else
printf("%.3lf %.3lf %.3lf %.3lf\n",x2,y2,x1,y1);
}
return ;
}
 
 
 
 
 

L - Points on Cycle(旋转公式)的更多相关文章

  1. 2016HUAS暑假集训训练2 L - Points on Cycle

    题目链接:http://acm.hust.edu.cn/vjudge/contest/121192#problem/L 这是一道很有意思的题,就是给定一个以原点为圆心的圆,然后给定 一个点  求最大三 ...

  2. hdu 1700 Points on Cycle(坐标旋转)

    http://acm.hdu.edu.cn/showproblem.php?pid=1700 Points on Cycle Time Limit: 1000/1000 MS (Java/Others ...

  3. HDU-1700 Points on Cycle

    这题的俩种方法都是看别人的代码,方法可以学习学习,要多看看.. 几何题用到向量.. Points on Cycle Time Limit: 1000/1000 MS (Java/Others)     ...

  4. 暑假集训(2)第九弹 ----- Points on Cycle(hdu1700)

                                                Points on Cycle Time Limit:1000MS     Memory Limit:32768 ...

  5. Points on Cycle (hdu1700,几何)

    Points on Cycle Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) ...

  6. hdu1700 Points on Cycle

    地址:http://acm.split.hdu.edu.cn/showproblem.php?pid=1700 题目: Points on Cycle Time Limit: 1000/1000 MS ...

  7. Points on cycle

    Description There is a cycle with its center on the origin. Now give you a point on the cycle, you a ...

  8. HDU1700:Points on Cycle

    Problem Description There is a cycle with its center on the origin. Now give you a point on the cycl ...

  9. hdu1700 Points on Cycle (数学)

    Problem Description There is a cycle with its center on the origin. Now give you a point on the cycl ...

随机推荐

  1. php核心技术与最佳实践知识点(下)

    九.缓存 1.缓存三大要素:命中率, 缓存更新策略,缓存最大数据量 2.命中率(mysql为例):mysql提供了一系列的query cache的global status来提现数据库缓存的情况: s ...

  2. 开源静态分析工具androguard体验

    原文链接:http://blog.csdn.net/xbalien29/article/details/21885297 虽然在windows端免费版的IDA.VTS等工具都可用来静态分析,但相对来说 ...

  3. 【Android 开发教程】动态添加Fragments

    本章节翻译自<Beginning-Android-4-Application-Development>,如有翻译不当的地方,敬请指出. 原书购买地址http://www.amazon.co ...

  4. ScrollView嵌套ListView冲突问题的最优解决方式

    项目做多了之后.会发现事实上ScrollView嵌套ListVew或者GridView等非经常常使用,可是你也会发现各种奇怪问题产生.依据个人经验如今列出常见问题以及代码最少最简单的解决方法. 问题一 ...

  5. python 在Windows中描述路径时出现的问题

    问题的根本:windows读取文件可以用\,但在字符串里面\被作为转义字符使用,   python在描述路径时有两种方式: 'd:\\a.txt',转义的方式 r'd:\a.txt',声明字符串不需要 ...

  6. 请实现一个函数,把字符串中的每一个空格替换成“%20”,比如输入 “We are Happly。” 则输出“we%20are%20happy。”

    请实现一个函数,把字符串中的每一个空格替换成"%20",比如输入 "We are Happly."  则输出"we%20are%20happy. &q ...

  7. [ci]sonar sonar-runner安装并实现手动扫描项目

    安装sonar: 下载地址:https://www.sonarqube.org/downloads/ wget https://sonarsource.bintray.com/Distribution ...

  8. apktool、dex2jar、jd-gui的区别及详解

    https://blog.csdn.net/themelove/article/details/53126360 反编译相关: apktool    作用:资源文件的获取,可以提取出图片文件和布局文件 ...

  9. Windows Mobile 6开发环境搭建

    Windows Mobile 6开发环境搭建 本文主要介绍在已有的Visual Studio 2005和Microsoft SQL Server2008环境基础上,如何搭建Windows Mobile ...

  10. Django中的request对象组成

    if  request.REQUEST.has_key('键值'): HttpRequest对象的属性 参考: 表 H-1. HttpRequest对象的属性 属      性 描述 path 表示提 ...