#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<algorithm>
using std::swap;
int gcd ( int x, int y )
{
int tmp;
if ( x < y ) swap(x,y);
while ( y ) { tmp = y; y = x % y; x = tmp; }
return x;
}
int main()
{
int x1, y1, x2, y2, x3, y3;
while ( 1 )
{
scanf("%d%d%d%d%d%d",&x1,&y1,&x2,&y2,&x3,&y3);
if ( !x1 && !y1 && !x2 && !y2 && !x3 && !y3 ) break;
double s =fabs((x1-x3)*(y2-y3)-(x2-x3)*(y1-y3)+0.0) / 2.0;
int dx1 = abs(x1-x2), dy1 = abs(y1-y2);
int dx2 = abs(x2-x3), dy2 = abs(y2-y3);
int dx3 = abs(x3-x1), dy3 = abs(y3-y1);
int b = gcd ( dx1, dy1 ) + gcd ( dx2, dy2 ) + gcd(dx3,dy3);
int i = (int)(s)- b / 2 + 1;
printf("%d\n",i);
}
return 0;
}
poj2954三角形内整数点的个数
最新推荐文章于 2019-03-09 15:32:28 发布