Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

比较水

Posted by KatrineYang at 2016-07-14 14:14:06 on Problem 1106
#include <iostream>
#include <stdio.h>
using namespace std;

int main() {
	int x0, y0;
	double r;
	while(1){
		scanf("%d%d%lf", &x0, &y0, &r);
		if(r < 0) return 0;
		int x[151], y[151];
		int gs;
		scanf("%d", &gs);
		int cnt = 0;
		for(int i = 0; i < gs; i++){
			int tempx, tempy;
			scanf("%d%d", &tempx, &tempy);
			if((x0-tempx)*(x0-tempx)+(y0-tempy)*(y0-tempy) <= r*r){
				x[cnt] = tempx; y[cnt] = tempy;
				cnt++;
			}
		}
		if(cnt <= 2){
			cout << cnt << endl;
			continue;
		}
		int mx = 0;
		for(int i = 0; i < cnt; i++){
			int temp = 0;
			for(int j = 0; j < cnt; j++){
				if((x[i]-x0)*(y[j]-y0) <= (x[j]-x0)*(y[i]-y0)) temp++;
			}
			if(temp > mx) mx = temp;
		}
		cout << mx << endl;
	}
	return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator