| 比赛 | NOIP模拟赛by mzx Day1 | 评测结果 | AAAAAAAAAA | 
    | 题目名称 | 为爱追寻 | 最终得分 | 100 | 
    | 用户昵称 | 灰里城 | 运行时间 | 6.437 s | 
    | 代码语言 | C++ | 内存使用 | 7.15 MiB | 
    | 提交时间 | 2016-10-19 19:16:23 | 
显示代码纯文本
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
const int maxn=1000010;
struct P{
	int x,y;
	bool operator < (const P &a)const{
		if(a.x==x)return y>a.y;
		return x>a.x;
	}
}p[maxn];
int main(){
	freopen("loverfinding.in","r",stdin);
	freopen("loverfinding.out","w",stdout);
	int n,sx,sy,tx,ty;
	scanf("%d%d%d%d%d",&n,&sx,&sy,&tx,&ty);
	if(sx==tx && sy==ty){
		printf("1\n");
//		getchar();getchar();
		fclose(stdin);fclose(stdout);
		return 0;
	}
	p[0].x=sx; p[0].y=sy; int i;
	for(i=1;i<=n;++i){
		scanf("%d%d",&sx,&sy);
		p[i].x=p[i-1].x+sx;
		p[i].y=p[i-1].y+sy;
		if(p[i].x==tx && p[i].y==ty)break;
	}
	if(i>n){
		printf("SingleDogMZX\n");
//		getchar();getchar();
		fclose(stdin);fclose(stdout);
		return 0;
	}
	sort(p+0,p+i+1); int ans=1;
	for(int j=1;j<=i;++j){
		if(p[j].x==p[j-1].x && p[j].y==p[j-1].y)continue;
		++ans;
	}
	printf("%d\n",ans);
//	getchar();getchar();
	fclose(stdin);fclose(stdout);
	return 0;
}