Advertisement
Guest User

Untitled

a guest
May 29th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.64 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. typedef long long ll;
  4.  
  5. int main(){
  6.     ll x, y, xa, ya, xb, yb;
  7.     cin>>x>>y>>xa>>ya>>xb>>yb;
  8.     ll cont1=0,cont2=0;
  9.     for(int i=0;i<=x;i++){
  10.         for(int j=0;j<=y;j++){
  11.             if(((xa-i)*(xa-i) + (ya-j)*(ya-j))>((xb-i)*(xb-i) + (yb-j)*(yb-j))) cont1++;
  12.             else if(((xa-i)*(xa-i) + (ya-j)*(ya-j))<((xb-i)*(xb-i) + (yb-j)*(yb-j))) cont2++;
  13.         }
  14.     }
  15.     double som = cont1+cont2;
  16.     double ans1,ans2;
  17.     if(som==0){
  18.         ans1=0.5;
  19.         ans2=0.5;
  20.     }else{
  21.         ans1=cont1/som;
  22.         ans2=cont2/som;
  23.     }
  24.     printf("%.6lf %.6lf\n",ans2,ans1);
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement