HDU 1590 Searching(求复数向量和的极限)
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 430 Accepted Submission(s): 77
"How can I find it on such a big lawn?"
"I will show you a hint: start from that tree which is in center of this lawn, and run directly to (X,Y) point. Please memorize the distance you'v passed. Then turn left with a angle A degree, and go ahead for k times of the length you'v passed in the first step. k is a real number from 0 to 1. When you arrive, repeat to turn left, and run for k times as far as the length of the last step. After many many times, you will reach a place, where I embed my letter..."
Of cause, Gardon wouldn't follow her hint simply. He just run there directly. Can you do it?
向量(x+yi)向左转a角度,大小为原来的k倍,得到向量(x’+y’i)转换公式:
x’=x*cos(a)-y*sin(a);
y’=y*cos(a)+x*sin(a);
=>(x’+y’i)=k*(cos(a)+sin(a)i)*(x+yi);
可以看出成等比数列;
题目就是求它的和的极限。
既:(X,Yi)=(x+yi)/((1,0)-k*(cos(a)+sin(a)i));
#include<cstring>
#include<complex>
#include<cmath>
#define pi acos(-1.0)
using namespace std;
typedef complex<double>Comp;
double x,y,A,k;
int main()
{
int i,j;
while(scanf("%lf%lf%lf%lf",&x,&y,&A,&k)!=EOF)
{
A=A*pi/180.0;
Comp a(x,y);
Comp b(-k*cos(A),-k*sin(A));
Comp c=a/b; printf("(%.3lf,%.3lf)\n",c.real(),c.imag());
}
return ;
}
HDU 1590 Searching(求复数向量和的极限)的更多相关文章
- hdu 5111 树上求交
hdu 5111 树上求交(树链剖分 + 主席树) 题意: 给出两棵树,大小分别为\(n1\),\(n2\), 树上的结点权值为\(weight_i\) 同一棵树上的结点权值各不相同,不同树上的结点权 ...
- hdu 4717(三分求极值)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4717 思路:三分时间求极小值. #include <iostream> #include ...
- hdu 4548 筛法求素数 打表
题目:http://acm.hdu.edu.cn/showproblem.php?pid=4548 Problem Description 小明对数的研究比较热爱,一谈到数,脑子里就涌现出好多数的问题 ...
- hdu 2870(dp求最大子矩阵)
题意:让你求的是由同一字母组成的最大子矩阵,w可以变成a或者b,x可以变成b或者c,y可以变成a或者c,z可以变成a或者b或者c. 分析:这是hdu 1506.hdu 1505的加强版,具体的分析看我 ...
- hdu 1505(dp求最大子矩阵)
题意:就是让你求出全由F组成的最大子矩阵. 分析:这是hdu 1506的加强版,只不过这道题变成了2维的,那我们就一行一行的来.具体的分析见1506的博客:http://www.cnblogs.com ...
- hdu 1506(dp求最大子矩阵)
题意:容易理解... 分析:对于每个单位矩阵,我们先求出连续比它高的最左边的下标假设为l,然后求出比它高的最右边的下标假设为r,然后矩阵的面积就是(r-l+1)*1:我们从左到 右扫一遍,求出每个点的 ...
- Hdu 4738【求无向图的桥】.cpp
题目: 曹操在长江上建立了一些点,点之间有一些边连着.如果这些点构成的无向图变成了连通图,那么曹操就无敌了.刘备为了防止曹操变得无敌,就打算去摧毁连接曹操的点的桥.但是诸葛亮把所有炸弹都带走了,只留下 ...
- hdu 2196(求树上每个节点到树上其他节点的最远距离)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2196 思路:首先任意一次dfs求出树上最长直径的一个端点End,然后以该端点为起点再次dfs求出另一个 ...
- hdu 2460(tarjan求边双连通分量+LCA)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2460 思路:题目的意思是要求在原图中加边后桥的数量,首先我们可以通过Tarjan求边双连通分量,对于边 ...
随机推荐
- python 字符串转变量方法
1.response=eval('requests.'+func.lower())(destURL, headers=requestHeaders, data=postData, params=que ...
- codeforces 251 div2 C. Devu and Partitioning of the Array 模拟
C. Devu and Partitioning of the Array time limit per test 1 second memory limit per test 256 megabyt ...
- 智能边缘计算,让IoT有大智慧
丹棱君有话说:什么是智能边缘计算(Edge Computing)?别着急,它可是与你与我都有着千丝万缕的联系.物联网(IoT)的概念早已飞入寻常百姓家,在日常生活中的许多场景发挥着“智能”作用.比如, ...
- python 集合交补
setx = set(["apple", "mango"]) sety = set(["mango", "orange" ...
- pyqt 调用颜色选择器
# -*- coding: utf- -*- from PyQt5.QtWidgets import QApplication, QPushButton, QColorDialog , QWidget ...
- jenkins 工作空间的目录
/usr/share/tomcat7/.jenkins/workspace/
- Unity寻路的动态烘焙
随着Unity5.6的推出,我们终于迎来了NavMesh的动态烘培,我们期待已久的功能终于来了,不用再研究A*算法了,话说改进的网格寻路更加方便高效. 网址:https://blog.csdn.net ...
- Java IO流-File类
2017-10-24 23:50:22 File类 File类:文件和目录路径名的抽象表示形式.该文件或者目录不一定真实存在. * 构造方法 File类有四种构造方法,主要采用的构造方法师第二种,也就 ...
- delphi文件名获取方法
取文件名 ExtractFileName(FileName); 取文件扩展名: ExtractFileExt(filename); 取文件名,不带扩展名: 方法一: Function Extrac ...
- 第二类斯特林数(转自http://www.cnblogs.com/gzy-cjoier/p/8426987.html )
转自http://www.cnblogs.com/gzy-cjoier/p/8426987.html 侵删