L - Points on Cycle(旋转公式)
L - Points on Cycle
Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u
Description
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
Output
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.
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
Sample Output
#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(旋转公式)的更多相关文章
- 2016HUAS暑假集训训练2 L - Points on Cycle
题目链接:http://acm.hust.edu.cn/vjudge/contest/121192#problem/L 这是一道很有意思的题,就是给定一个以原点为圆心的圆,然后给定 一个点 求最大三 ...
- 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
这题的俩种方法都是看别人的代码,方法可以学习学习,要多看看.. 几何题用到向量.. Points on Cycle Time Limit: 1000/1000 MS (Java/Others) ...
- 暑假集训(2)第九弹 ----- Points on Cycle(hdu1700)
Points on Cycle Time Limit:1000MS Memory Limit:32768 ...
- 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 ...
- HDU1700:Points on Cycle
Problem Description There is a cycle with its center on the origin. Now give you a point on the cycl ...
- hdu1700 Points on Cycle (数学)
Problem Description There is a cycle with its center on the origin. Now give you a point on the cycl ...
随机推荐
- zoj 1100 - Mondriaan's Dream
题目:在m*n的地板上铺上同样的1*2的地板砖,问有多少种铺法. 分析:dp,组合,计数.经典dp问题,状态压缩. 状态:设f(i,j)为前i-1行铺满,第i行铺的状态的位表示为j时的铺砖种类数: 转 ...
- 通过 react-native-keyboard-aware-scroll-view 解决键盘遮盖输入框的问题
1.安装 yarn add react-native-keyboard-aware-scroll-view 2.引入 import { KeyboardAwareScrollView } from ' ...
- 谷歌Cartographer学习 -快速安装测试
参考资料:https://www.cnblogs.com/hitcm/p/5939507.html PC下面进行安装: 遇到的问题如下 1.首先安装ceres solver 在编译的时候,如果是低配的 ...
- 请求大神,C#如何截取字符串中指定字符之间的部分 按指定字符串分割 一分为二 c# 去除字符串中的某个已知字符
string stra = "abcdefghijk";string strtempa = "c";string strtempb = "j" ...
- JavaScript 事件循环及异步原理(完全指北)
引言 最近面试被问到,JS 既然是单线程的,为什么可以执行异步操作? 当时脑子蒙了,思维一直被困在 单线程 这个问题上,一直在思考单线程为什么可以额外运行任务,其实在我很早以前写的博客里面有写相关的内 ...
- java中的参数传递——值传递、引用传递
参数是按值而不是按引用传递的说明 Java 应用程序有且仅有的一种参数传递机制,即按值传递. 在 Java 应用程序中永远不会传递对象,而只传递对象引用.因此是按引用传递对象.Java 应用程序按引用 ...
- Shell脚本与vi编辑器:vi启动与退出、工作模式、命令大全
Vi简介 Vi是一种广泛存在于各种UNIX和Linux系统中的文本编辑程序. Vi不是排版程序,只是一个纯粹的文本编辑程序. Vi是全屏幕文本编辑器,它没有菜单,只有命令. Vi不是基于窗口的,所以, ...
- FAT32和NTFS最大支持的单个文件大小分别是多大?
以前,RAID控制器和文件系统都有2TB的限制.控制器上的限制,主要是指每个LUN不能大于2TB,而磁盘组一般则没有这个限制:文件系统的限制主要是指每个分区(partition)不能大于2TB,不过3 ...
- ActionBar + ViewPager(PagerSlidingTabStrip)
既然是要实现ActionBar.那么第一步当然就是编辑menu文件夹下的main.xml文件了.代码例如以下所看到的: <menu xmlns:android="http://sche ...
- fzu 2250 不可能弹幕结界 分析+模拟,考察思维严谨。
Problem 2250 不可能弹幕结界 Accept: 5 Submit: 13Time Limit: 1000 mSec Memory Limit : 65536 KB Problem ...