[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 ...
随机推荐
- SpringBoot3.x原生镜像-Native Image实践
前提 之前曾经写过一篇<SpringBoot3.x 原生镜像-Native Image 尝鲜>,当时SpringBoot处于3.0.0-M5版本,功能尚未稳定.这次会基于SpringBoo ...
- typora使用教程&高级用法&Markdown
typora使用教程&高级用法&Markdown typora介绍 哇啦哇啦哇啦哇,,,,,,,,,,,,, 提示:小白看不懂的话,建议哔哩哔哩搜索"遇见狂神说", ...
- 三维模型OSGB格式轻量化的跨平台兼容性技术分析
三维模型OSGB格式轻量化的跨平台兼容性技术分析 在三维模型应用中,OSGB格式轻量化处理是一种常见的技术手段,可以通过数据压缩.简化.滤波等操作,降低三维模型数据的存储空间和传输带宽需求,提高应用程 ...
- 细聊C# AsyncLocal如何在异步间进行数据流转
前言 在异步编程中,处理异步操作之间的数据流转是一个比较常用的操作.C#异步编程提供了一个强大的工具来解决这个问题,那就是AsyncLocal.它是一个线程本地存储的机制,可以在异步操作之间传递数据. ...
- 使用 OpenTelemetry 构建 .NET 应用可观测性(2):OpenTelemetry 项目简介
前世今生 OpenTracing OpenTracing 项目启动于 2016 年,旨在提供一套分布式追踪标准,以便开发人员可以更轻松地实现分布式追踪. OpenTracing 定义了一套 Traci ...
- 【目标检测】RCNN算法实现
一.前言 RCNN(Regions with CNN features)算法由Ross Girshick在2014年的论文"Rich feature hierarchies for accu ...
- subDomainBrute源码分析
SubDomainsBrute简介 SubDomainsBrute是一款目标域名收集工具 ,用小字典递归地发现三级域名.四级域名.五级域名等不容易被探测到的域名.字典较为全面,小字典就包括3万多条 ...
- Avalonia开发(二)项目结构解析
一.前言 在Avalonia开发(一)环境搭建 文章中介绍了Avalonia的介绍.开发环境的搭建.项目创建,以及项目FirstAvaloniaApp项目结构的介绍.本篇文章将介绍各平台的项目介绍. ...
- No module named virtualenvwrapper 虚拟环境报错
No module named virtualenvwrapper 虚拟环境报错 安装虚拟环境命令 sudo pip install virtualenv sudo pip install virtu ...
- HOMER7配置告警
概述 HOMER是一款100%开源的针对SIP/VOIP/RTC的抓包工具和监控工具. HOMER是一款强大的.运营商级.可扩展的数据包和事件捕获系统,是基于HEP/EEP协议的VoIP/RTC监控应 ...