http://acm.hdu.edu.cn/showproblem.php?pid=2080
代码:
#include <bits/stdc++.h> using namespace std; #define pi 3.14159265 int main() { int T; while(~scanf("%d", &T)) { for(int i =1 ; i <= T; i ++) { double x1, y1, x2, y2; scanf("%lf%lf%lf%lf", &x1, &y1, &x2, &y2); double l1, l2, l3, ans; l1 = sqrt(x1 * x1 + y1 * y1); l2 = sqrt(x2 * x2 + y2 * y2); l3 = sqrt((y2 - y1) * (y2 - y1) + (x2 - x1) * (x2 - x1)); ans = acos((l1 * l1+ l2 * l2 - l3 * l3) / ( 2 * l1 * l2)) * 180 / pi; printf("%0.2lf\n", ans); } } return 0; }
原文:https://www.cnblogs.com/zlrrrr/p/9388621.html