嘟嘟嘟

直接O(n ^ 2)暴力判断就行了。

对于圆,判断该点和圆心的距离是否小于半径。

然而为啥我这么写编译不过:

  1. scanf("%lf%lf%lf%lf", &a[++cnt1].xl, &a[cnt1].yl, &a[cnt1].xr, &a[cnt1].yr);

++cnt1必须拎出来写?!……

  1. #include<cstdio>
  2. #include<iostream>
  3. #include<algorithm>
  4. #include<cmath>
  5. #include<cstring>
  6. #include<cstdlib>
  7. #include<vector>
  8. #include<queue>
  9. #include<stack>
  10. #include<cctype>
  11. using namespace std;
  12. #define enter puts("")
  13. #define space putchar(' ')
  14. #define Mem(a) memset(a, 0, sizeof(a))
  15. typedef long long ll;
  16. typedef double db;
  17. const int INF = 0x3f3f3f3f;
  18. const db eps = 1e-;
  19. const int maxn = 3e5 + ;
  20. const int maxm = 5e4 + ;
  21. inline ll read()
  22. {
  23. ll ans = ;
  24. char ch = getchar(), last = ' ';
  25. while(!isdigit(ch)) last = ch, ch = getchar();
  26. while(isdigit(ch)) ans = (ans << ) + (ans << ) + ch - '', ch = getchar();
  27. if(last == '-') ans = -ans;
  28. return ans;
  29. }
  30. inline void write(ll x)
  31. {
  32. if(x < ) putchar('-'), x = -x;
  33. if(x >= ) write(x / );
  34. putchar(x % + '');
  35. }
  36.  
  37. int n, m;
  38. struct Rec
  39. {
  40. db xl, yl, xr, yr;
  41. }a[maxn];
  42. struct Cir
  43. {
  44. db x, y, r;
  45. }b[maxn];
  46. int cnt1 = , cnt2 = ;
  47.  
  48. int ans[maxm];
  49. void judge(const db& x, const db& y, const int& id)
  50. {
  51. for(int i = ; i <= cnt1; ++i)
  52. {
  53. if(a[i].yl <= a[i].yr)
  54. {
  55. if(a[i].xl < x && a[i].xr > x && a[i].yl < y && a[i].yr > y) ans[id]++;
  56. }
  57. else if(a[i].xl < x && a[i].xr > x && a[i].yr < y && a[i].yl > y) ans[id]++;
  58. }
  59. for(int i = ; i <= cnt2; ++i)
  60. if((x - b[i].x) * (x - b[i].x) + (y - b[i].y) * (y - b[i].y) < b[i].r * b[i].r) ans[id]++;
  61. }
  62.  
  63. int main()
  64. {
  65. n = read(); m = read();
  66. for(int i = ; i <= n; ++i)
  67. {
  68. char c[]; scanf("%s", c);
  69. if(c[] == 'r')
  70. {
  71. cnt1++;
  72. scanf("%lf%lf%lf%lf", &a[cnt1].xl, &a[cnt1].yl, &a[cnt1].xr, &a[cnt1].yr);
  73. if(a[cnt1].xl > a[cnt1].xr) swap(a[cnt1].xl, a[cnt1].xr), swap(a[cnt1].yl, a[cnt1].yr);
  74. }
  75. else cnt2++, scanf("%lf%lf%lf", &b[cnt2].x, &b[cnt2].y, &b[cnt2].r);
  76. }
  77. for(int i = ; i <= m; ++i)
  78. {
  79. db x, y; scanf("%lf%lf", &x, &y);
  80. judge(x, y, i);
  81. }
  82. for(int i = ; i <= m; ++i) write(ans[i]), enter;
  83. return ;
  84. }

[HNOI2005]汤姆的游戏的更多相关文章

  1. BZOJ 1199: [HNOI2005]汤姆的游戏 计算几何暴力

    1199: [HNOI2005]汤姆的游戏 Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://www.lydsy.com/JudgeOnline/p ...

  2. 洛谷 P2313 [HNOI2005]汤姆的游戏 题解

    P2313 [HNOI2005]汤姆的游戏 题目描述 汤姆是个好动的孩子,今天他突然对圆规和直尺来了兴趣.于是他开始在一张很大很大的白纸上画很多很多的矩形和圆.画着画着,一不小心将他的爆米花弄撒了,于 ...

  3. 几何【P2313】 [HNOI2005]汤姆的游戏

    顾z 你没有发现两个字里的blog都不一样嘛 qwq 题目描述--->p2313 [HNOI]汤姆的游戏 分析 说不上是分析. 数据范围给出来,这题明显暴力啊emmm. 个人认为的坑点. 这题不 ...

  4. 1199: [HNOI2005]汤姆的游戏 - BZOJ

    Description 汤姆是个好动的孩子,今天他突然对圆规和直尺来了兴趣.于是他开始在一张很大很大的白纸上画很多很多的矩形和圆.画着画着,一不小心将他的爆米花弄撒了,于是白纸上就多了好多好多的爆米花 ...

  5. P2313 [HNOI2005]汤姆的游戏

    题目描述 汤姆是个好动的孩子,今天他突然对圆规和直尺来了兴趣.于是他开始在一张很大很大的白纸上画很多很多的矩形和圆.画着画着,一不小心将他的爆米花弄撒了,于是白纸上就多了好多好多的爆米花.汤姆发现爆米 ...

  6. bzoj千题计划176:bzoj1199: [HNOI2005]汤姆的游戏

    http://www.lydsy.com/JudgeOnline/problem.php?id=1199 求出圆x的范围 把要判断的点按x从小到大排序 枚举图形 二分出x满足这个图形的一段区间 枚举这 ...

  7. 汤姆大叔 javascript 系列 第20课 最后的5到javascript题目

    博客链接:http://www.cnblogs.com/TomXu/archive/2012/02/10/2342098.html 原题: 大叔注:这些题目也是来自出这5个题目的人,当然如果你能答对4 ...

  8. 你必须知道ASP.NET知识------关于动态注册httpmodule(对不起汤姆大叔)

    一.关于动态注册的问题 很多人看过汤姆大叔的MVC之前的那点事儿系列(6):动态注册HttpModule ,其实汤姆大叔没有发现httpmodule动态注册的根本机制在哪里. 亦即:怎么动态注册?为什 ...

  9. 我读汤姆大叔的深入理解js(二)

    继续汤姆大叔的js之旅. 揭秘命名函数表达式 函数表达式和函数声明 汤姆大叔在博客中引用ECMA规范:函数声明必须带有标识符,函数表达式可以省略.对于我来说这些概念的东西真是不所适从.还是大叔的实例带 ...

随机推荐

  1. 针对Eclipse闪退的两种解决方案

    闪退情况是:双击Eclipse登陆按钮,显示图标后,紧接着关闭: 1. 到eclipse文件夹中的eclipse.ini打开编辑在最后加入下面代码保存即可 -Dorg.eclipse.swt.brow ...

  2. Recommend ways to overwrite hashCode() in java

    Perface In the former chapter, I talk about topics about hashCode, And I will continue to finish the ...

  3. bzoj1061 NOI2018 志愿者招募——solution

    Description 申奥成功后,布布经过不懈努力,终于成为奥组委下属公司人力资源部门的主管.布布刚上任就遇到了一个难 题:为即将启动的奥运新项目招募一批短期志愿者.经过估算,这个项目需要N 天才能 ...

  4. 浏览器根对象navigator之客户端检测

    Navigator的5个主要属性: appName:Web浏览器的名称 appVersion:浏览器的版本号和其他版本信息 userAgent:浏览器在它的USER-AGENT HTTP标题中发送的字 ...

  5. windows如何查看nvidia显卡(GPU)的利用率和温度

    windows如何查看nvidia显卡(GPU)的利用率和温度 nvidia-smi 只要在文件夹C:\Program Files\NVIDIA Corporation\NVSMI里找到文件nvidi ...

  6. 使用Callable和Future接口创建线程

    具体是创建Callable接口的实现类,并实现clall()方法.并使用FutureTask类来包装Callable实现类的对象,且以此FutureTask对象作为Thread对象的target来创建 ...

  7. clipChildren属性

    <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android=&quo ...

  8. UnicodeEncodeError: 'ascii' codec can't encode characters in position 2-5: ordin al not in range(128)——解决方案备注

    在vim中使用ycm插件时,偶尔会出现: “UnicodeEncodeError: 'ascii' codec can't encode characters in position 2-5: ord ...

  9. 【日常记录】【unity3d】 OnTriggerEnter 和 OnCollisionEnter (2D) 的区别

    问题:两个物体A,B 两者都有碰撞体 collider(Box Collider,Sphere Collider,Capsule Collider等)当两物体相撞时,会进入 OnTriggerEnte ...

  10. Sql Server tempdb原理-启动过程解析实践

    我们知道在SqlServer实例启动过程中数据库会进行还原(Redo,Undo)然后打开提供服务,但我们知道tempdb是不提供重做机制的(Redo)那tempdb是如何还原的呢?如果tempdb损坏 ...