solve LightOJ 1433 Minimum Arc Distance in c++
#include<iostream>
#include<math.h>
#include<iomanip>
using namespace std;
int main()
{
int t, test;
double ox, oy, ax, ay, bx, by, a, b, o, angle_o, min_dis;
cin >> test;
for(t = 1; t <= test; t++)
{
cin >> ox >> oy >> ax >> ay >> bx >> by;
b = sqrt((ox - ax) * (ox - ax) + (oy - ay) * (oy - ay));
a = sqrt((ox - bx) * (ox - bx) + (oy - by) * (oy - by));
o = sqrt((bx - ax) * (bx - ax) + (by - ay) * (by - ay));
angle_o = acos((b*b + a*a - o*o)/(2 * b * a));
min_dis = a * angle_o;
cout << "Case " << t << ": " << fixed << setprecision(8) << min_dis << endl;
}
return 0;
}
___ahmed shuvo 969
কোন মন্তব্য নেই:
একটি মন্তব্য পোস্ট করুন