bzoj2829】的更多相关文章

[BZOJ2829][SHOI2012]信用卡凸包(凸包) 题面 BZOJ 洛谷 题解 既然圆角的半径都是一样的,而凸包的内角和恰好为\(360°\),所以只需要把圆角的圆心弄下来跑一个凸包,再额外加上一个圆的周长就好了. 浮点精度卡不过,洛谷上有人给了一份代码,加上去特判一下就过了... #include<iostream> #include<cstdio> #include<cmath> #include<algorithm> using namespa…
[BZOJ2829] 信用卡 (凸包) 题面 信用卡是一个矩形,唯四个角做了圆滑处理,使他们都是与矩形两边相切的1/4园,如下图所示,现在平面上有一些规格相同的信用卡,试求其凸包的周长.注意凸包未必是多边形,因为他有可能包含若干段圆弧. 分析 我们发现凸包的圆弧段可以缩成一个圆,然后将直线段向内平移,就可以组成一个多边形 因此对每个卡的四个圆心跑凸包,答案为凸包周长+一个圆的周长 注意四个圆心的计算要用到向量旋转,向量\((x,y)\)逆时针旋转\(\alpha\)(弧度)之后会变成\((x\c…
裸题,直接上凸包,然后加上一个圆周即可 只是在这之前没写过旋转而已 const pi=3.14159265358979323; eps=1e-8; type point=record x,y:double; end; ..] of point; q:..] of longint; n,i,k,t:longint; ans,a,b,x,y,an,r:double; procedure swap(var a,b:point); var c:point; begin c:=a; a:=b; b:=c;…
题目描述 输入 输出 样例输入 2 6.0 2.0 0.0 0.0 0.0 0.0 2.0 -2.0 1.5707963268 样例输出 21.66 提示 本样例中的2张信用卡的轮廓在上图中用实线标出,如果视1.5707963268为Pi/2(pi为圆周率),则其凸包的周长为16+4*sqrt(2) 我们先将每个信用卡看成是由四个圆心组成的矩形,那么凸包就是所有圆心形成的凸包.现在每个圆心往外扩展为一个圆,那么就是用凸包来包住所有的圆,而新的凸包的直边部分就是原凸包对应边往外平移得到.对于曲面部…
传送门 题意:给nnn个A∗BA*BA∗B的矩形,其中每个矩形的四个角被改造成了半径为rrr的四分之一 圆,问这些矩形的凸包周长. 思路:考虑求出圆心的凸包周长然后加上一个整圆的周长,证明很简单,略掉. 代码: #include<bits/stdc++.h> #define ri register int using namespace std; const int N=10005; struct pot{ double x,y; friend inline pot operator+(con…
题目描述 输入 输出 样例输入 26.0 2.0 0.00.0 0.0 0.02.0 -2.0 1.5707963268 样例输出 21.66 题解 凸包 傻逼题,答案显然为:所有圆心构成的凸包周长+一个圆的周长.这里求凸包用的方法是求上下两个凸壳再拼起来. 时间复杂度为排序的 $O(n\log n)$ 我才不会告诉你puts("nan:)可以过呢 #include <cmath> #include <cstdio> #include <algorithm>…
http://hzwer.com/6330.html #include<cstdio> #include<cmath> #include<algorithm> using namespace std; #define N 100001 #define EPS 0.00000001 typedef double db; const db PI=acos(-1.0); struct Point{db x,y;}p[N<<2],bao[N<<2]; b…
Time Limit: 10 Sec  Memory Limit: 128 MBSec  Special JudgeSubmit: 333  Solved: 155 Description Input Output Sample Input 2 6.0 2.0 0.0 0.0 0.0 0.0 2.0 -2.0 1.5707963268 Sample Output 21.66 HINT 本样例中的2张信用卡的轮廓在上图中用实线标出,如果视1.5707963268为 Pi/2(pi为圆周率),则其凸…
凸包题. 我们先把所有信用卡的四个定点的坐标求出来,然后计算凸包长度,最后加上一个圆的周长就行. #include <cstdlib> #include <cstdio> #include <cctype> #include <cstring> #include <cmath> #include <iostream> #include <algorithm> #define rep(i, l, r) for(int i=l…
counter: 664BZOJ1601 BZOJ1003 BZOJ1002 BZOJ1192 BZOJ1303 BZOJ1270 BZOJ3039 BZOJ1191 BZOJ1059 BZOJ1202 BZOJ1051 BZOJ1001 BZOJ1588 BZOJ1208 BZOJ1491 BZOJ1084 BZOJ1295 BZOJ3109 BZOJ1085 BZOJ1041 BZOJ1087 BZOJ3038 BZOJ1821 BZOJ1076 BZOJ2321 BZOJ1934 BZOJ…