这 是 人 做 的 ?

蒙自市凤凰小学又阝十尃亻二  •  1年前


include <bits/stdc++.h>114514114514114514114514

using namespace std;

int main() {

int n;
scanf("%d", &n);
double wt, wp;
scanf("%lf%lf", &wt, &wp);
double sumt = wt, sump = wp;
double maxnt = wt, minit = wt, maxnp = wp, minip = wp; 
double anst = 0, ansp = 0; 
double lastt = wt, lastp = wp; 
int xiong = 0;
for (int i = 2; i <= n; i++) {
	double tmpt = 0, tmpp = 0; 
	scanf("%lf%lf", &tmpt, &tmpp);
	if (tmpt - lastt >= -15 && tmpt - lastt <= 15 && tmpp - lastp >= -15 && tmpp - lastp <= 15 && tmpt - wt >= -20
	        && tmpt - wt <= 20 && tmpp - wp >= -20 && tmpp - wp <= 20) {
		if (maxnt < tmpt)
			maxnt = tmpt;
		if (minit > tmpt)
			minit = tmpt;
		if (maxnp < tmpp)
			maxnp = tmpp;
		if (minip > tmpp)
			minip = tmpp; 
		sumt += tmpt;
		sump += tmpp; 
		lastt = tmpt;
		lastp = tmpp; 
	} else {
		xiong++;
	}
}
n -= xiong;
if (n >= 3) {
	sumt -= (maxnt + minit);
	sump -= (maxnp + minip);
	anst = sumt / (n * 1.0 - 2.0);
	ansp = sump / (n * 1.0 - 2.0); 
} else {
	anst = sumt / (n * 1.0);
	ansp = sump / (n * 1.0);
}
printf("%.3lf %.3lf\n", anst, ansp);
if (anst > ansp) {
	printf("winner:t\n");
} else if (anst == ansp) {
	printf("0\n");
} else
	printf("winner:p\n");
printf("%d", xiong);
return 0;

}


评论:

请先登录,才能进行评论