Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- #define INF 1000010000
- #define nl '\n'
- #define pb push_back
- #define ppb pop_back
- #define mp make_pair
- #define fi first
- #define se second
- #define pii pair<int,int>
- #define pdd pair<double,double>
- #define all(c) (c).begin(), (c).end()
- #define SORT(c) sort(all(c))
- #define rep(i,n) for( int i = 0; i < n; ++i )
- #define repi(i,n) for( int i = 1 ; i <= n; ++i )
- #define repn(i,n) for( int i = n - 1 ; i >= 0 ; --i )
- #define repf(j,i,n) for( int j = i ; j < n ; ++j )
- #define die(s) {std::cout << s << nl;}
- #define dier(s) {std::cout << s; return 0;}
- #define vi vector<int>
- typedef long long ll;
- using namespace std;
- int main() {
- ios_base::sync_with_stdio(false);
- cin.tie(NULL);
- cout.precision(3);
- cout.setf(ios::fixed);
- double x , y , x1 , y1 , x2 , y2 , x3 , y3 , r;
- while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3){
- x=((y3-y2)/2+(x1-x3)*(x1+x3)/2/(y1-y3)-(x1-x2)*(x1+x2)/2/(y1-y2))/((x1-x3)/(y1-y3)-(x1-x2)/(y1-y2));
- y=((x3-x2)/2+(y1-y3)*(y1+y3)/2/(x1-x3)-(y1-y2)*(y1+y2)/2/(x1-x2))/((y1-y3)/(x1-x3)-(y1-y2)/(x1-x2));
- if(x1==x2) y = (y1 + y2) / 2;
- if(x1==x3) y = (y1 + y3) / 2;
- if(y1==y2) x = (x1 + x2) / 2;
- if(y1==y3) x = (x1 + x3) / 2;
- r = sqrt((x - x1)*(x - x1) + (y - y1)*(y - y1));
- if(fabs(x)!=0.) cout << "(";
- cout << "x";
- if(fabs(x)!=0.){
- if(x >= 0) cout << " - ";
- else cout << " + ";
- cout << fabs(x) << ")";
- }
- cout << "^2 + ";
- if(fabs(y)!=0.) cout << "(";
- cout << "y";
- if(fabs(y)!=0.){
- if(y >= 0) cout << " - ";
- else cout << " + ";
- cout << fabs(y) << ")";
- }
- cout << "^2 = " << r << "^2" << nl;
- cout << "x^2 + y^2 ";
- if(x != 0.){
- if(x<0) cout << "+ ";
- else cout << "- ";
- cout << fabs(x*2) << "x ";
- }
- if(y != 0.){
- if(y<0) cout << "+ ";
- else cout << "- ";
- cout << fabs(y*2) << "y ";
- }
- if(x , y , x*x + y*y - r*r != 0.){
- if(x , y , x*x + y*y - r*r>0) cout << "+ ";
- else cout << "- ";
- cout << fabs(x*x + y*y - r*r) << " ";
- }
- cout << "= 0" << nl << nl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement