题解:P10520 [XJTUPC2024] 榕树之心

· · 题解

题目传送门
没什么好说的,按照公式输出就行了,注意精度问题即可

代码:

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

int main(){
    double x, y;//精度
    cin >> x >> y;
    printf("%lf %lf", 0.5 * (x + y), sqrt(3.0) / 2.0 * (x - y));//精度
    return 0;
}

AC记录