比赛 |
NOIP模拟赛by mzx Day1 |
评测结果 |
TTTTTTTTTT |
题目名称 |
为爱追寻 |
最终得分 |
0 |
用户昵称 |
L_in |
运行时间 |
10.009 s |
代码语言 |
C++ |
内存使用 |
0.28 MiB |
提交时间 |
2016-10-19 21:24:50 |
显示代码纯文本
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<map>
using namespace std;
int n,fx,fy,endx,endy,ans;
struct Point{
int x,y;
Point(){;}
Point(int a,int b){x=a;y=b;}
bool operator<(const Point&A)const{
if(A.x==x)return y<A.y;
return x<A.x;
}
};
map<Point,int> m;
int main()
{
freopen("loverfinding.in","r",stdin);
freopen("loverfinding.out","w",stdout);
scanf("%d",&n);
scanf("%d%d%d%d",&fx,&fy,&endx,&endy);
m[Point(fx,fy)]=1;ans++;
if(fx==endx&&fy==endy){
printf("%d\n",ans);
return 0;
}
int x,y;
for(int i=1;i<=n;i++){
scanf("%d%d",&x,&y);
fx+=x;fy+=y;
if(m[Point(fx,fy)]!=1){
m[Point(fx,fy)]=1;
ans++;
}
if(fx==endx&&fy==endy){
printf("%d\n",ans);
return 0;
}
}
puts("SingleDogMZX");
return 0;
fclose(stdin);fclose(stdout);
return 0;
}