H. BQG's Quadrilateral Bricks
Time Limit: 2000ms
Memory Limit: 32768KB
64-bit integer IO format:
%lld Java class name:
Main
![Big \ Q \ God Big \ Q \ God](http://www.bnuoj.com/v3/functions/latexrender/pictures/452ca35779267682d31b87da49b2a42e.png)
现在
手中有一种简单四边形砖块,给出平面上四个点的坐标
,依次连接这四个点,得到的四边形就是砖块的形状,他想知道这种砖块是不是好砖块。
![BQG BQG](http://www.bnuoj.com/v3/functions/latexrender/pictures/70a7772303b35bfed91d3a9833df1fd6.png)
![(x,y) (x,y)](http://www.bnuoj.com/v3/functions/latexrender/pictures/90cbc22edf225adf8a68974f51227f05.png)
Input
第一行是一个正整数
,表示测试数据的组数,
![T(T \leq 100000) T(T \leq 100000)](http://www.bnuoj.com/v3/functions/latexrender/pictures/e34713f377400a41bed54b22b3734712.png)
每组测试数据只有一行,
包含八个整数
,表示砖块的四个顶点的坐标,
![x_1,y_1,x_2,y_2,x_3,y_3,x_4,y_4 x_1,y_1,x_2,y_2,x_3,y_3,x_4,y_4](http://www.bnuoj.com/v3/functions/latexrender/pictures/885ed9a7bdd6c6b4821d591336075fb3.png)
所有坐标均在
范围内,
![[-1000000000,1000000000] [-1000000000,1000000000]](http://www.bnuoj.com/v3/functions/latexrender/pictures/c09ef4e44bfca60434170bd3244facb7.png)
保证任意两点不重合,任意三点不共线,砖块一定是简单四边形。
Output
对于每组测试数据,输出一行,
如果是好砖块,输出“BQG is happy!”,否则输出“BQG is so sad!”(均不含引号)。
Sample Input
2 0 0 0 1 1 1 1 0 0 0 1 1 1 2 0 1
Sample Output
BQG is happy! BQG is happy!
Hint
Quadrilateral
[英][ˌkwɒdrɪˈlætərəl][美][ˌkwɑ:drɪˈlætərəl]
adj. 四边(形)的;
n. 四边形;
#include<stdio.h>
#include<string.h>
#include<iostream>
#include<stdlib.h>
#include<algorithm>
using namespace std;
int main(){
int T;
long long int x1,y1,x2,y2,x3,y3,x4,y4;
cin>>T;
while(T--){
scanf("%d%d%d%d%d%d%d%d",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
printf("BQG is happy!\n");
}
return 0;
}