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

坑很多,还是要注意细节。不得不吐槽,难道又到了计算几何只能套模板否则就一串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. 实现spring IOC的常见二种方法 setter注入与构造器注入

    案例: beans.xml配置 <?xml version="1.0" encoding="UTF-8"?><beansxmlns=" ...

  2. 在hadoop运行tensor flow

    http://www.infoq.com/cn/articles/deeplearning-tensorflow-casestudy http://www.tuicool.com/articles/a ...

  3. python的读写和写读操作

    # 读写操作 (读写操作是正常的)f = open('log',mode='r+',encoding='utf-8') # log是文件名 print(f.read()) f.write(" ...

  4. linux sleep用法

    应用程序:#include <syswait.h>usleep(n) //n微秒Sleep(n)//n毫秒sleep(n)//n秒驱动程序:#include <linux/delay ...

  5. Egit的merge合并冲突具体解决方法

    稍微总结下弄了半个下午的egit的merge合并冲突解决方法,网上看的都是一个模板出来的,看的糊里糊涂,花了很多时间去实验整个合并流程.. 前提工作 创建一个普通JAVA工程Test,创建一个类Tes ...

  6. js获取地址栏信息

    参考: http://www.w3school.com.cn/jsref/dom_obj_location.asp http://www.xxx.com:8081/ location.host = w ...

  7. js switch case注意事项

    今天写switch的时候发现没有达到预期效果,参照w3school的写法发现语法一致 想了一下,js是弱类型语言,是不是不支持number?试了一下将数字改为字符串,果然可以了 或者可以这样写:swi ...

  8. The valid characters are defined in RFC 7230 and RFC 3986

    网上大都说什么发送格式与协议定义的不兼容,改tomcat版本或改编码之类的. 本人测试的时候换了个浏览器,不用IE就好了 如果坚持用ie,也有解决方式 @参考文章 成功的方法 在请求地址var url ...

  9. 乱序字符串anagrams

    [抄题]: 给出一个字符串数组S,找到其中所有的乱序字符串(Anagram).如果一个字符串是乱序字符串,那么他存在一个字母集合相同,但顺序不同的字符串也在S中. 对于字符串数组 ["lin ...

  10. centos6.6中修改yum源

    1.进入设置yum源的目录 > cd /etc/yum.repos.d 2.复制或重命名CentOS-Base.repo文件 > mv CentOS-Base.repo CentOS-Ba ...