[ABC246B] Get Closer
section>
Problem Statement
From the point $(0,0)$ in a two-dimensional plane, let us move the distance of $1$ toward the point $(A, B)$. Find our coordinates after the move.
Here, after moving the distance of $d$ from a point $X$ to a point $Y$ ($d \le$ length of the segment $XY$), we are at the point on the segment $XY$ whose distance from $X$ is $d$.
The Constraints guarantee that the distance between the points $(0, 0)$ and $(A, B)$ is at least $1$.
Constraints
- All values in input are integers.
- $0 \le A,B \le 1000$
- $(A,B) \neq (0,0)$
Input
Input is given from Standard Input in the following format:
$A$ $B$
Output
Let $(x, y)$ be our coordinates after the move. Print $x$ and $y$ in this order, separated by a space.
Your output is considered correct when, for each printed value, the absolute or relative error from the judge's answer is at most $10^{−6}$.
Sample Input 1
3 4
Sample Output 1
0.600000000000 0.800000000000
Printing 0.5999999999 0.8000000001, for example, would also be accepted.
Sample Input 2
1 0
Sample Output 2
1.000000000000 0.000000000000
We may arrive at $(A, B)$.
Sample Input 3
246 402
Sample Output 3
0.521964870245 0.852966983083
可以用一个相似。首先求出 $(x,y)$ 到原点的距离 $d$ ,然后把他给相似到 $d$,也就是 $x/=d$,$y/=d$。
#include<bits/stdc++.h>
int x,y;
double d;
int main()
{
scanf("%d%d",&x,&y);
d=sqrt(x*x+y*y);
printf("%.8lf %.8lf",x/d,y/d);
}
[ABC246B] Get Closer的更多相关文章
- A CLOSER LOOK AT CSS
A CLOSER LOOK AT CSS css-review Congratulations! You worked hard and made it to the end of a challen ...
- Here we take a closer look at the Jordans Unveil
Here we take a closer look at the Jordans Unveil. This Mens release is both unique and striking. The ...
- 论文笔记 | A Closer Look at Spatiotemporal Convolutions for Action Recognition
( 这篇博文为原创,如需转载本文请email我: leizhao.mail@qq.com, 并注明来源链接,THX!) 本文主要分享了一篇来自CVPR 2018的论文,A Closer Look at ...
- But what exactly do we mean by "gets closer to"?
https://rdipietro.github.io/friendly-intro-to-cross-entropy-loss/ [将输入转化为输出:概率分布] When we develop a ...
- They're much closer in spirit to how our brains work than feedforward networks.
http://neuralnetworksanddeeplearning.com/chap1.html Up to now, we've been discussing neural networks ...
- Table View Programming Guide for iOS---(六)---A Closer Look at Table View Cells
A Closer Look at Table View Cells A table view uses cell objects to draw its visible rows and then c ...
- Facebook's React vs AngularJS: A Closer Look
When we launched React | A JavaScript library for building user interfaces two weeks ago there were ...
- NASA: A Closer View of the Moon(近距离观察月球)
Posted to Twitter by @Astro_Alex, European Space Agency astronaut Alexander Gerst, this image shows ...
- Multipath TCP on iOS11 : A closer look at the TCP Options(转)
Multipath TCP uses a variety of TCP options to use different paths simultaneously. Several Multipath ...
- Shorthand Argument Names $0 : 只用于指代Closer声明中的形参
Shorthand Argument Names Swift automatically provides shorthand argument names to inline closures, w ...
随机推荐
- ATtiny88初体验(三):串口
ATtiny88初体验(三):串口 ATtiny88单片机不包含串口模块,因此只能使用软件方式模拟串口时序. 串口通信时序通常由起始位.数据位.校验位和停止位四个部分组成,常见的配置为1位起始位.8位 ...
- P4327题解
思路 分组计算 以下图为例: ..#.. .#.. .*.. .#.. .#.#. #.#. *.*. #.#. #.X.# .X.* .X.* .X.# .#.#. #.#. *.*. #.#. . ...
- api接口的使用原理是什么?
随着互联网的发展和不同系统之间的交互越来越频繁,API接口的使用已经成为软件开发和集成中不可或缺的一部分.API接口的使用原理是通过预定义的接口规范,软件系统可以调用或提供API接口的服务,来实现 ...
- Git命令详细使用指南
Git命令详细使用指南 Git是一种广泛使用的版本控制系统,它可以帮助开发人员跟踪变更.协作项目和有效管理代码仓库.无论你是初学者还是有经验的用户,理解各种Git命令对于高效的代码管理至关重要. 安装 ...
- Oracle主键自增列
SQL Server创建主键自增列我们可以使用"ID INT IDENTITY(1,1) NOT NULL PRIMARY KEY"一步到位创建,而Oracle创建主键自增列和SQ ...
- 「codeforces - 1621G」Weighted Increasing Subsequences
link. 一个 dp(拜谢 ly)和切入点都略有不同的做法,并不需要观察啥性质. 原问题针对子序列进行规划,自然地想到转而对前缀进行规划.接下来我们考虑一个前缀 \([1, i]\) 以及一个 \( ...
- C++指针和地址偏移在HotSpot VM中的应用
在前面我们介绍过new运算符,这个操作实际上上包含了如下3个步骤: 调用operator new的标准库函数.此函数会分配一块内存空间以便函存储相应类型的实例. 调用相应类的构造函数 返回一个指向该对 ...
- C#开源、功能强大、免费的Windows系统优化工具 - Optimizer
前言 今天给大家推荐一款由C#开源.功能强大.免费的Windows系统优化工具 - Optimizer. 工具介绍 Optimizer是一款功能强大的Windows系统优化工具,可帮助用户提高计算机性 ...
- day02 数据类型转换 运算符 方法
数据类型转换 自动类型转换 强制类型转换 1. 自动类型转换:就是范围小的向范围大的转换 将取值范围小刀的类型自动提升为取值范围大的类型. 转换规则 byte.short.char int--- ...
- C#学习笔记--变量类型的转换
变量类型的转化: 转换原则 同类型的大的可以装小的,小类型的装大的就需要强制转换. 隐式转换: 同种类型的转换: //有符号 long-->int-->short-->sbyte l ...