[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 ...
随机推荐
- 接到一个新需求应该怎么做?(V1.0)
接到一个新需求应该怎么做?(V1.0) 1 背景 在做业务研发的时候,经常会接到一些 产品需求/技术需求, 无论需求大小,都需要一套可以重复使用的方法论,来保证整个项目的正常交付,这篇思考就是总结梳理 ...
- 第一个程序PingPong
功能需求 如图所示,开启两个ping类型的服务ping1和ping2,ping1给ping2发消息,ping2收到回应ping1,ping1收到再回应ping2,不断循环. 服务模块 Skynet提供 ...
- Java Maven POM配置参考
介绍 什么是POM? POM代表"项目对象模型".它是一个名为pom.XML的文件中保存的Maven项目的XML表示. 快速概览 这是一个直接位于POM项目元素下的元素列表.请注意 ...
- Python 导入 Excel多sheet
Python 导入 Excel多sheet 假设表格的样式如下 import os import sys import django BASE_DIR = os.path.dirname(os.pat ...
- PanGu-Coder2:从排序中学习,激发大模型潜力
本文分享自华为云社区<PanGu-Coder2:从排序中学习,激发大模型潜力>,作者: 华为云软件分析Lab . 2022年7月,华为云PaaS技术创新Lab联合华为诺亚方舟语音语义实验室 ...
- c++ 常用的 STL
c++ 中常用的 STL vector //vector 变长数组 倍增的思想(倍增:系统为每一个程序分配空间的时候,所需要的时间和空间大小无关,与请求次数相关)尽量减少请求的次数 /* 返回元素的个 ...
- 聊聊基于Alink库的推荐系统
概述 Alink提供了一系列与推荐相关的组件,从组件使用得角度来看,需要重点关注如下三个方面: 算法选择 推荐领域有很多算法,常用的有基于物品/用户的协同过滤.ALS.FM算法等.对于不同的数据场景, ...
- 【Qt6】列表模型——树形列表
QStandardItemModel 类作为标准模型,主打"类型通用",前一篇水文中,老周还没提到树形结构的列表,本篇咱们就好好探讨一下这货. 还是老办法,咱们先做示例,然后再聊知 ...
- tiptop查询通配符
*:表示任何符合的字符,例:A*,表示要找出全部为 A 开头的资料. ?:表示任一符合的字符,例:A?,表示要找出第一码为 A,第二码为任何 字符,但总共只有二码之数据. 注:以上二功能仅可在文字字段 ...
- 【matplotlib 实战】--漏斗图
漏斗图,形如"漏斗",用于展示数据的逐渐减少或过滤过程.它的起始总是最大,并在各个环节依次减少,每个环节用一个梯形来表示,整体形如漏斗.一般来说,所有梯形的高度应是一致的,这会有助 ...