比赛 NOIP模拟赛by mzx Day1 评测结果 ETTTTTTTTT
题目名称 为爱追寻 最终得分 0
用户昵称 Shirry 运行时间 9.671 s
代码语言 C++ 内存使用 0.94 MiB
提交时间 2016-10-19 20:05:11
显示代码纯文本
#include<cstdio>
#include<vector>
#include<algorithm>
#include<functional>
using namespace std;
int n,x0,y0,xt,yt,ans=1;
class T{
public:
	int x,y;
}temp;
vector<T>A;
bool zz=false;
struct TFindByCoord : public std::binary_function<T,T,bool>{
    bool operator()(const T &obj1,const T &obj2)const{
        return obj1.x==obj2.x&&obj1.y==obj2.y;
    }
};
int main(){
	freopen("loverfinding.in","r",stdin);
	freopen("loverfinding.out","w",stdout);
	scanf("%d%d%d%d%d",&n,&x0,&y0,&xt,&yt);
	temp.x=x0;temp.y=y0;
	A.push_back(temp);
	int dx,dy;
	for(int i=1;i<=n;i++){
		scanf("%d%d",&dx,&dy);
		temp.x+=dx;
		temp.y+=dy;
		if(temp.x==xt&&temp.y==yt){
			ans++;
			zz=true;
			break;
		}
		std::vector<T>::iterator result=std::find_if(A.begin(),A.end(),std::bind2nd(TFindByCoord(),temp));
		if(result==A.end()){
			A.push_back(temp);
			ans++;
		}
	}
	if(zz==true)printf("%d",ans);
	else printf("SingleDogMZX");
	return 0;
}