比赛 NOIP模拟赛by mzx Day1 评测结果 TTTTTTTTTT
题目名称 为爱追寻 最终得分 0
用户昵称 L_in 运行时间 10.009 s
代码语言 C++ 内存使用 0.28 MiB
提交时间 2016-10-19 21:24:50
显示代码纯文本
  1. #include<iostream>
  2. #include<cstdio>
  3. #include<cstring>
  4. #include<cmath>
  5. #include<algorithm>
  6. #include<map>
  7. using namespace std;
  8. int n,fx,fy,endx,endy,ans;
  9. struct Point{
  10. int x,y;
  11. Point(){;}
  12. Point(int a,int b){x=a;y=b;}
  13. bool operator<(const Point&A)const{
  14. if(A.x==x)return y<A.y;
  15. return x<A.x;
  16. }
  17. };
  18. map<Point,int> m;
  19. int main()
  20. {
  21. freopen("loverfinding.in","r",stdin);
  22. freopen("loverfinding.out","w",stdout);
  23. scanf("%d",&n);
  24. scanf("%d%d%d%d",&fx,&fy,&endx,&endy);
  25. m[Point(fx,fy)]=1;ans++;
  26. if(fx==endx&&fy==endy){
  27. printf("%d\n",ans);
  28. return 0;
  29. }
  30. int x,y;
  31. for(int i=1;i<=n;i++){
  32. scanf("%d%d",&x,&y);
  33. fx+=x;fy+=y;
  34. if(m[Point(fx,fy)]!=1){
  35. m[Point(fx,fy)]=1;
  36. ans++;
  37. }
  38. if(fx==endx&&fy==endy){
  39. printf("%d\n",ans);
  40. return 0;
  41. }
  42. }
  43. puts("SingleDogMZX");
  44. return 0;
  45. fclose(stdin);fclose(stdout);
  46. return 0;
  47. }