看八戒在做这个题,我也做了做。。

坑很多,还是要注意细节。不得不吐槽,难道又到了计算几何只能套模板否则就一串WA的情况了么!

要不是八戒做出来了,这题我估计我也就扔到这里了。。哥不服啊~所以得做出来!

注意这个题,重复点、直线等关键词。还有,判断直线跟线段交点,需要先剪枝,就是判断这个线段端点跟直线端点叉乘是不是小于eps就行了。

)

e-
?(x):-(x))<eps)

)
{
    point q2;
    , count;
    , q2.x = rand() + offset_x, q2.y = rand() + offset_y; i < n; i++)
    ) % n])) && (p[i].x - q.x)*(p[(i + ) % n].x - q.x) < eps && (p[i].y - q.y)*(p[(i + ) % n].y - q.y) < eps)
        ) % n], q2) < -eps&&xmult(p[i], q, p[(i + ) % n])*xmult(p[i], q2, p[(i + ) % n]) < -eps)
        count++;
    ;
}

];
        memset(p, , ; i < num_of_point; i++)
        {
            cin >> p[i].x >> p[i].y;
            ];; i < num_of_line; i++)
        {
            line temp;
            cin >> temp.a.x >> temp.a.y >> temp.b.x >> temp.b.y;

point intersects[];
            memset(intersects, , ;

; i < num_of_point; i++)
            {
                ], temp.a, temp.b) < eps)], temp.a, temp.b)) < eps)] };
                    point inter = intersection(a, temp);
                    intersects[count_of_intersects++] = inter;
                }
            }
            sort(intersects, intersects + count_of_intersects, cmp);
            ;
            ; i < count_of_intersects - ; i++)
            {
                point center = { (intersects[i].x + intersects[i + ].x) / , (intersects[i].y + intersects[i + ].y) /  };
                , p, (, ();
                 || flag == )
                    ans += dist(intersects[i], intersects[i + ]);
            }
            cout << fixed << setprecision() << ans << endl;
        }
    }
    ;
}

poj2462的更多相关文章

随机推荐

  1. Nunit与Vs 2012配合使用

    要使用Nunit首先要去官网 http://www.nunit.org/ 下载Nunit.win  .msi是安装版.   bin  .zip是绿色版. 下载完后安装. 在 VS2012 中使用 Nu ...

  2. java非常好用的读取文件的流的代码

    学过java的都知道java中有非常多的读取文件流的操作.这个要回到javase的io操作了.io流说实话,初学者学的肯定会非常混乱,那么多流,什么输入流,输出流,什么文件流,什么字节流,等等.我在这 ...

  3. 转)Ubuntu安装mysql5.7

    主要参考http://blog.csdn.net/q894523017/article/details/50705392 包去官网下载,解压,安装步骤如下: 上文中有错误,正确如下: sudo dpk ...

  4. 验证二叉查找树 · Validate Binary Search Tree

    [抄题]: [思维问题]: 不知道要定义resultType, 其实用仔细分析判断条件就行了:是否是bst+最大最小值 类似于平衡二叉树:是否平衡+左右的高度差 [一句话思路]: [输入量]:空: 正 ...

  5. 将Boost库添加到Visual Studio 2017

    在windows 环境中,一般比较推荐的打包软件的方式是,将自己所需要的共享库放在软件自己的文件夹中,并且避免与其它的软件共用.除非是微软的官方组件,比如微软自家的VC Runtime. Boost库 ...

  6. 【D3D】Direct3D中LPRECT(上左右底)和LPoint(x,y)之前转换

    D3DSprite.cpp void CD3DSprite::DrawText(CD3DFont *pFont, char *szString, RECT &DesRect, D3DCOLOR ...

  7. 对于某些浏览器不支持placeholder的解决办法

    $(function () { if (!placeholderSupport()) { $('[placeholder]').focus(function () { var input = $(th ...

  8. 移动端bug之解决方式

    1.Android中元素被点击时产生的边框: * { -webkit-tap-highlight-color: rgba(250,250,250,0);   /*更改点击事件的焦点色*/} 2.去除移 ...

  9. 20172325 2017-2018-2 《Java程序设计》第六周学习总结

    20172325 2017-2018-2 <Java程序设计>第六周学习总结 教材学习内容总结 1.利用[ ]建立一个数组,整列数据可以通过数组名引用,数组中的每个元素则可以通过其在数组中 ...

  10. c++之boost share_ptr

    转载:https://www.cnblogs.com/welkinwalker/archive/2011/10/20/2218804.html