比赛 |
NOIP模拟赛by mzx Day1 |
评测结果 |
TTTTTTTTTT |
题目名称 |
为爱追寻 |
最终得分 |
0 |
用户昵称 |
destiny |
运行时间 |
10.004 s |
代码语言 |
C++ |
内存使用 |
0.28 MiB |
提交时间 |
2016-10-19 21:46:08 |
显示代码纯文本
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<set>
using namespace std;
int ans,stx,sty,edx,edy,n,xn,yn;
bool f=0;
struct Node
{
int x,y;
Node(){}
Node(int a,int b)
{
x=a;y=b;
}
bool operator <(const Node &b)const
{
if(x<b.x)return 1;
if(x==b.x&&y<b.y)return 1;
return 0;
}
};
set <Node> s;
int main()
{
freopen("loverfinding.in","r",stdin);
freopen("loverfinding.out","w",stdout);
scanf("%d%d%d%d%d",&n,&stx,&sty,&edx,&edy);
ans=1;xn=stx;yn=sty;s.insert(Node(stx,sty));
for(int i=1;i<=n;i++)
{
int dx,dy;scanf("%d%d",&dx,&dy);
xn+=dx;yn+=dy;//it=s.find(Node(xn,yn));
if(!s.count(Node(xn,yn))){ans++;s.insert(Node(xn,yn));}
//printf("i==%d ans==%d %d\n",xn,yn,ans);
if(xn==edx&&edy==yn){f=1;break;}
}
if(f)printf("%d\n",ans);
else printf("SingleDogMZX\n");//while(1);
fclose(stdin);
fclose(stdout);
//system("pause");
return 0;
}