jakaria_hossain

lightoj - 1433 - Minimum Arc Distance

Aug 22nd, 2019
111
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. typedef long long ll;
  4. int main()
  5. {
  6. int t;
  7. cin>>t;
  8. for(int i=1;i<=t;i++)
  9. {
  10. double ox,oy,ax,ay,bx,by,O,A,B,ang;
  11. cin>>ox>>oy>>ax>>ay>>bx>>by;
  12. O=sqrt((bx-ax)*(bx-ax)+(by-ay)*(by-ay));
  13. A=sqrt((ox-bx)*(ox-bx)+(oy-by)*(oy-by));
  14. B=sqrt((ox-ax)*(ox-ax)+(oy-ay)*(oy-ay));
  15. ang=acos(((A*A)+(B*B)-(O*O)) / (2.0*A*B));
  16. ang*=A;
  17. cout<< "Case "<<i<< ": "<<setprecision(8)<<fixed<<ang<<endl;
  18. }
  19. }
RAW Paste Data