Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #define gc getchar unlocked
- #ifndef ONLINE JUDGE
- #define gc getchar
- #endif // ONLINE JUDGE
- #define pc putchar_unlocked
- #ifndef ONLINE JUDGE
- #define pc putchar
- #endif // ONLINE JUDGE
- #define fRead freopen("input.txt","r",stdin)
- #define fWrite freopen ("output.txt","w",stdout)
- #define eps 1e-8
- #define inf 0x3f3f3f3f
- #define INF 2e18
- #define LL long long
- #define ULL unsigned long long
- #define PI acos(-1.0)
- #define pb push_back
- #define mk make_pair
- #define pii pair<int,int>
- #define pLL pair<LL,LL>
- #define ff first
- #define ss second
- #define all(a) a.begin(),a.end()
- #define rall(a) a.rbegin(),a.rend()
- #define SQR(a) ((a)*(a))
- #define Unique(a) sort(all(a)),a.erase(unique(all(a)),a.end())
- #define min3(a,b,c) min(a,min(b,c))
- #define max3(a,b,c) max(a,max(b,c))
- #define min4(a,b,c,d) min(min(a,b),min(c,d))
- #define max4(a,b,c,d) max(max(a,b),max(c,d))
- #define Iterator(a) __typeof__(a.begin())
- #define rIterator(a) __typeof__(a.rbegin())
- #define FOR(a,it) for(Iterator(a) it = a.begin();it != a.end(); it++)
- #define rFOR(a,it) for(rIterator(a) it = a.rbegin();it != a.rend(); it++)
- using namespace std;
- const int MOD = 1e9 + 7;
- int fx[] = {+1,-1,+0,+0,+1,+1,-1,-1,+0};
- int fy[] = {+0,+0,+1,-1,+1,-1,+1,-1,+0};
- template <typename T> inline T GCD (T a,T b ) {a = abs(a);b = abs(b);while ( b ) { a = a % b; swap ( a, b ); } return a;}
- template <typename T> inline T LCM(T x,T y){T tp = GCD(x,y);if( (x / tp) * 1. * y > 9e18) return 9e18;return (x / tp) * y;}
- template <typename T> inline T BigMod(T A,T B,T M){T ret = 1;while(B){if(B & 1) ret = (ret * A) % M;A = (A * A) % M;B = B >> 1;}return ret;}
- template <typename T> inline T InvMod (T A,T M){return BigMod(A,M-2,M);}
- /*---------------------------fast I/O------------------------------------*/
- #define scani2(a,b) scani(a) , scani(b)
- #define scani3(a,b,c) scani(a), scani(b), scani(c)
- #define scani4(a,b,c,d) scani(a), scani(b), scani(c), scani(d)
- #define scani5(a,b,c,d,e) scani(a), scani(b), scani(c), scani(d) , scani(e)
- template <typename T> bool scani(T &n){n = 0;bool got = false;bool negative = false;char c = gc();while( c < '0' || c > '9'){if(c == '-') negative = true;c = gc();}while(c >= '0' && c <= '9'){got = true;n = n*10 + c-48;c = gc();}if(negative) n = ~(n-1);return got;}
- template <typename T> void write(T n,int type = true){if(n<0) {pc('-');n = -n;}if(!n) {pc('0');if(type==32) pc(' '); else if(type) pc('\n'); return;}char buff[22];int len = 0;while(n) buff[len++] = n%10+48,n/=10;for(int i=len-1;i>=0;i--) pc(buff[i]);if(type==32) pc(' '); else if(type) pc('\n');}
- int scans(char *a){int i=0;char c = 0;while(c < 33) c = gc();while(c > 33){a[i++] = c;c = gc();}a[i] = 0;return i;}
- /*********************************************** End of template *********************************************/
- int main()
- {
- int t , qq = 1;
- scani(t);
- while(t--){
- double x0,y0,rx,ry,px,py;
- scanf("%lf %lf %lf %lf %lf %lf",&x0,&y0,&ry,&rx,&px,&py);
- double mx,my;
- x0 -= px;
- y0 -= py;
- //mx = (x0 + x0 + rx) / 2 = (2 * x0 + rx) / 2;
- //my = (y0 + y0 + ry) / 2 = (2 * y0 + ry) / 2;
- mx = (2.0 * x0 + rx) * .5;
- my = (2.0 * y0 + ry) * .5;
- if(!mx && !my){
- mx += px;
- y0 += py;
- printf("%f %f\n%f %f\n",mx,y0,mx,y0+ry);
- continue;
- }
- double x1,y1,x2,y2;
- x1 = y0 * (mx / my);
- if(x0 <= x1 && x1 <= x0 + rx){
- x2 = (y0 + ry) * (mx / my);
- x1 += px;
- x2 += px;
- y0 += py;
- printf("%f %f\n%f %f\n",x1,y0,x2,y0+ry);
- }
- else {
- y1 = x0 * (my / mx);
- y2 = (x0 + rx) * (my / mx);
- x0 += px;
- y1 += py;
- y2 += py;
- printf("%f %f\n%f %f\n",x0,y1,x0+rx,y2);
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement