比赛 |
NOIP模拟赛by mzx Day1 |
评测结果 |
AAAAAAAAAT |
题目名称 |
为爱追寻 |
最终得分 |
90 |
用户昵称 |
浮生随想 |
运行时间 |
5.002 s |
代码语言 |
C++ |
内存使用 |
19.40 MiB |
提交时间 |
2016-10-19 18:54:25 |
显示代码纯文本
#include<cstdlib>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
#define maxn 5010
#define ll long long
#define END fclose(stdin);fclose(stdout);return 0;
int n,x0,y0,xt,yt;
bool f[maxn][maxn];
int read(){
int x,f=1;
char ch;
while(ch=getchar(),!isdigit(ch))if(ch=='-')f=-1;
x=ch-'0';
while(ch=getchar(),isdigit(ch))x=x*10+ch-'0';
return x*f;
}
int main(){
freopen("loverfinding.in","r",stdin);
freopen("loverfinding.out","w",stdout);
n=read();x0=read();y0=read();xt=read();yt=read();
int tem=1;f[x0+2500][y0+2500]=1;
for(int i=1;i<=n;i++){
int a=read(),b=read();
x0+=a;y0+=b;
if(!f[x0+2500][y0+2500]){
//cout<<x0<<" "<<y0<<endl;
f[x0+2500][y0+2500]=1;
tem++;
}
if(x0==xt&&y0==yt){
printf("%d",tem);
goto end;
}
}
printf("SingleDogMZX");
end:;
//while(1);
END
}