[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 ...
随机推荐
- 使用 docker 打包构建部署 Vue 项目,一劳永逸解决node-sass安装问题
文章源于 Jenkins 构建 Vue 项目失败,然后就把 node_modules 删了重新构建发现 node-sass 安装不上了,折腾一天终于可以稳定构建了. 犹记得从学 node 的第一天,就 ...
- 《SQL与数据库基础》19. 日志
目录 日志 错误日志 二进制日志 日志格式 日志查看 日志删除 查询日志 慢查询日志 本文以 MySQL 为例 日志 错误日志 错误日志是 MySQL 中最重要的日志之一,它记录了当 mysql 启动 ...
- 《小白WEB安全入门》01. 扫盲篇
@ 目录 基础知识 什么是WEB 什么是前端 什么是后端 什么是数据库 什么是协议 什么是WEB安全 什么是服务器 什么是IP地址.端口 什么是局域网.广域网.内网.外网 什么是URL 什么是MAC地 ...
- 选择合适的方法进行API接口调试
随着互联网的快速发展,API(Application Programming Interface)接口在软件开发中扮演着重要的角色.调试API接口是确保系统正常运行的关键步骤之一.本文将介绍如何选择适 ...
- mall :hutool项目源码解析
目录 一.mall开源项目 1.1 来源 1.2 项目转移 1.3 项目克隆 二.Hutool工具类库 2.1 Hutool 简介 三.源码解析 3.1 集成与配置 3.1.1 导入依赖 3.1.2 ...
- Tongweb远程调试
最近,在对项目进行国产化时,要求springboot项目容器换成tongweb.在部署中,有个问题一直无法在本地重现,搜了下网上资料,基本没法实现,所以我整理了下.注意,项目包代码必须与本地代码保持一 ...
- 【项目源码】JavaWeb网上购书系统
JavaWeb网上购书系统 介绍 采用JSP.Servlet.MySQL.Tomcat8.0开发的网上购书系统. 软件架构 网上书城主要功能如下: (1) 前台(客户购买)部分: ① 用户管理:注册会 ...
- Python操作Word水印:添加文字或图片水印
在Word文档中,可以添加半透明的图形或文字作为水印,以保护文档的原创性,防止未经授权的复制或使用.除了提供安全功能外,水印还可以展示文档创作者的信息.附加的文档信息,或者仅用于文档的装饰.本文将介绍 ...
- NewStarCTF 2023 公开赛道 WEEK4|MISC 部分WP
R通大残 1.题目信息 R通大残,打了99,补! 2.解题方法 仔细分析题目,联想到隐写的R通道. 首先解释一下:R是储存红色的通道,通道里常见有R(红).G(绿).B(蓝)三个通道,如果关闭了R通道 ...
- Null return value from advice does not match primitive return type for
1.org.springframework.aop.AopInvocationException:Null return value from advice does not match primit ...