当前位置:网站首页>Plane vector addition
Plane vector addition
2022-07-03 14:33:00 【Study hard 867】
This question requires the preparation of procedures , Calculate the sum of two two-dimensional plane vectors .
Input format :
Type in a line and press “x1 y1 x2 y2” The format gives two two two-dimensional plane vectors v1=(x1,y1) and v2=(x2,y2) Components of .
Output format :
In a row, press (x, y) Format output and vector , The coordinates are output to one digit after the decimal point ( Note that... Cannot be output −0.0).
sample input :
3.5 -2.7 -13.9 8.7
sample output :
(-10.4, 6.0)Code :
#include <stdio.h>
#include <math.h>
int main()
{
double x1,y1,x2,y2;
scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2);
double x,y;
x=x1+x2;
y=y1+y2;
// When x,y The absolute value of is less than 0.05 when , Unqualified “ No output -0.0”, here x,y The value of should be set to 0.0
if(fabs(x)<0.05)
{
x = 0.0;
}
if(fabs(y)<0.05)
{
y = 0.0;
}
printf("(%.1f, %.1f)",x,y);
return 0;
}
边栏推荐
- [clean up the extraordinary image of Disk C]
- 洛谷P3065 [USACO12DEC]First! G 题解
- NFT新的契机,多媒体NFT聚合平台OKALEIDO即将上线
- 愉悦资本新双币基金近40亿元完成首次关账
- ConstraintLayout 的使用
- How Facebook moves instagram from AWS to its own server
- etcd集群权限管理和账号密码使用
- 数学常数表 by q779
- 关于敏捷的一些概念
- Why is this error reported when modifying records in the database
猜你喜欢

Paper sharing: generating playful palettes from images

Niuke: crossing the river

Leetcode (4) -- find the median of two positively ordered arrays

7-15 calculation of PI

Accelerating strategy learning using parallel differentiable simulation

GRPC的四种数据流以及案例

Leetcode (4) - - trouver la médiane de deux tableaux ordonnés positifs
![Luogu p4047 [jsoi2010] tribal division solution](/img/7f/3fab3e94abef3da1f5652db35361df.png)
Luogu p4047 [jsoi2010] tribal division solution

Detailed explanation of four modes of distributed transaction (Seata)

Tiantu investment sprint Hong Kong stocks: asset management scale of 24.9 billion, invested in xiaohongshu and Naixue
随机推荐
Raft agreement
retrofit
7-11 calculation of residential water charges by sections
PCB中常用快捷键
Mongodb index
超简单手机地图开发
Frequently asked questions: PHP LDAP_ add(): Add: Undefined attribute type in
tonybot 人形机器人 查看端口并对应端口 0701
Luogu p5194 [usaco05dec]scales s solution
NFT新的契机,多媒体NFT聚合平台OKALEIDO即将上线
必贝特医药冲刺科创板:年营收97万亏损1.37亿 拟募资20亿
添加Zabbix计算类型项目Calculated items
Tailing rushes to the scientific and Technological Innovation Board: it plans to raise 1.3 billion, and Xiaomi Changjiang is the shareholder
泰凌冲刺科创板:拟募资13亿 国家大基金与小米长江是股东
Code writing and playing method of tonybot humanoid robot at fixed distance
7-2 and then what time (15 minutes)
Although not necessarily the best, it must be the hardest!
X86 assembly language - Notes from real mode to protected mode
NPM install is stuck with various strange errors of node NPY
7-18 finding the single root of polynomial by dichotomy