⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 1633.cpp

📁 这是哈尔滨工业大学acmOJ的源代码
💻 CPP
字号:
/*  This Code is Submitted by wywcgs for Problem 1633 on 2006-06-24 at 15:50:29 */ 
#include <cstdio>
#include <algorithm>
using namespace std;

const int PN = 256;
const double eps = 1e-4;

int main()
{
	int n, cx, cy, x[PN], y[PN];
	int i, j;
	double cr;
	
	while(scanf("%d %d %lf", &cx, &cy, &cr) != EOF && cr > eps) {
		int r = (int)(cr+eps), tn = 0, best = 0;
		scanf("%d", &n);
		for(i = 0; i < n; i++) {
			scanf("%d %d", &x[tn], &y[tn]);
			if((x[tn]-cx)*(x[tn]-cx)+(y[tn]-cy)*(y[tn]-cy) <= r*r) tn++;
		}
		for(i = 0; i < tn; i++) {
			int a = -(cy-y[i]), b = cx-x[i], c = -(a*cx+b*cy), l = 0, r = 0;
			for(j = 0; j < tn; j++) {
				if(a*x[j]+b*y[j]+c <= 0) l++;
				if(a*x[j]+b*y[j]+c >= 0) r++;
			}
			best = max(best, max(l, r));
		}
		printf("%d\n", best);
	}
	
	return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -