UVA 10167

来源:互联网 发布:最新网络电影预告片 编辑:程序博客网 时间:2024/05/20 02:25
#include <stdio.h>#include <math.h>#include <stdlib.h>#define MAX 200typedef struct cherry{int x, y;}C;int N;C ch[MAX];int cal( int A, int B ){int time, x, y;x = y = 0;for( time = 0; time < 2*N; time++ ){if( (ch[time].x * A + ch[time].y * B) > 0 )x++;if( (ch[time].x * A + ch[time].y * B) < 0 )y++;}if( x == y  && x + y == 2 *N )return 1;elsereturn 0;}int main(){int  i, flag, j;while( scanf( "%d", &N ) && N ){flag = 0;for( i = 0; i < 2*N; i++ )scanf( "%d%d", &ch[i].x, &ch[i].y );for( i = -500; i <= 500; i++ ){for( j = -500; j <= 500; j++ )if( cal( i, j ) ){printf( "%d %d\n", i, j );flag = 1;break;}if( flag )break;}}return 0;}

原创粉丝点击