比赛 NOIP模拟赛by mzx Day1 评测结果 TTTTTTTTTT
题目名称 为爱追寻 最终得分 0
用户昵称 抽空的太阳 运行时间 10.006 s
代码语言 C++ 内存使用 68.95 MiB
提交时间 2016-10-19 20:58:55
显示代码纯文本
  1. #include<iostream>
  2. #include<cstdio>
  3. #include<algorithm>
  4. #define lon long long
  5. using namespace std;
  6. const int maxn=10000010;
  7. lon n,x0,y0,xt,yt,tot,a[maxn];
  8. bool flag;
  9. lon init()
  10. {
  11. lon f=1,x=0;char c=getchar();
  12. while(c>'9'||c<'0'){if(c=='-')f=-1;c=getchar();}
  13. while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}
  14. return f*x;
  15. }
  16. int main()
  17. {
  18. freopen("loverfinding.in","r",stdin);
  19. freopen("loverfinding.out","w",stdout);
  20. lon x,y,s;
  21. n=init();x0=init();y0=init();xt=init();yt=init();
  22. a[++tot]=(x0-1)*maxn+y0;
  23. for(int i=1;i<=n;i++)
  24. {
  25. x=init();y=init();
  26. x0=x0+x;y0=y0+y;
  27. s=(x0-1)*maxn+y0;
  28. a[++tot]=s;
  29. if(x0==xt&&y0==yt)
  30. {
  31. flag=1;
  32. break;
  33. }
  34. }
  35. if(flag)
  36. {
  37. sort(a+1,a+tot+1);
  38. int ans=unique(a+1,a+tot+1)-a-1;
  39. cout<<ans;
  40. return 0;
  41. }
  42. cout<<"SingleDogMZX";
  43. return 0;
  44. }