题目链接:https://ac.nowcoder.com/acm/problem/124648
解题思路:
注意这是凸包,是凸包,是凸包。还有当角度大于180度的时候,就相当于减去。
1 #include <bits/stdc++.h> 2 using namespace std; 3 #define PI acos(-1) 4 int main() { 5 int n, d; 6 while (cin >> n >> d) { 7 double ans = 0; 8 while (n--) { 9 int x; 10 cin >> x; 11 ans += d * d * sin(PI * x / 180) / 2; 12 } 13 cout << fixed << setprecision(3) << ans << endl; 14 } 15 return 0; 16 }