| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
死活不过啊,都用的INT型了,精度不能不够啊?哪位大牛指点一下!#include <stdio.h>
#include <math.h>
#include <string.h>
#define pi (acos(-1))
#define eq 1e-10
struct point {
int x, y;
};
int mul (point a, point b, point z) {
return((a.x-z.x)*(b.y-z.y)-(b.x-z.x)*(a.y-z.y));
}
bool rad(point a, point b) {
point z;
z.x = 0;
z.y = 0;
if(mul(a, b, z)<0) {
return false;
}
if ((a.x * b.x + a.y * b.y) < 0 && (a.x * b.x + a.y * b.y) * (a.x * b.x + a.y * b.y) > (a.x * a.x + a.y * a.y) * (b.x * b.x + b.y * b.y) / 4) {
return false;
}
return true;
}
int main () {
int casen;
int r;
point a, b, c;
bool z;
for(scanf("%d", &casen); casen; casen -- ){
z = false;
scanf("%d", &r);
scanf("%d%d", &a.x, &a.y);
if(a.x == 0 && a.y == 0) {
z = true;
}
scanf("%d%d", &b.x, &b.y);
if(b.x == 0 && b.y == 0) {
z = true;
}
scanf("%d%d", &c.x, &c.y);
if(c.x == 0 && c.y == 0 ) {
z = true;
}
if(z) {
printf("No\n");
continue;
}
// printf("%lf %lf %lf %lf\n", rad(a, b), rad(a, c), rad(b, c), 2*pi/3);
if((rad(a, b) && rad(a, c))
|| (rad(b, a) && rad(b, c))
|| (rad(c, b) && rad(c, a))) {
printf("No\n");
}
else {
printf("Yes\n");
}
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator