跳到正文

题解

题解:P10520 [XJTUPC2024] 榕树之心

_114514eggy_约 1 分钟
原文
文章信息与版本

文章信息

发布
2024年5月20日
收录
2026年9月23日
更新
2026年11月11日
篇幅
约 1 分钟
题目
P10520

版本

  1. v1当前

题目大意:给出 xx 和 yy,输出 12x+12y\frac{1}{2}x+\frac{1}{2}y 和 32x−32y\frac{\sqrt3}{2}x-\frac{\sqrt3}{2}y ,用空格隔开。
思路:开 double,有点细节,直接输出。

code:

C++
#include<bits/stdc++.h>
using namespace std;

int main()
{
    double a,b,c;
    cin>>a>>b;
    c=sqrt(3);//方便
    cout <<fixed<<setprecision(5)<<a/2.00000+b/2.00000<<" "<<fixed<<setprecision(5)<<a*c/2.00000-b*c/2.00000;//一定要加.00000
    return 0;
}
原文