思路:

把信用卡周围去掉  只剩下中间的长方形

最后的答案加上一个圆

//By SiriusRen
#include <bits/stdc++.h>
using namespace std;
const int N=;
const double eps=1e-;
int card,n,m,k;
double a,b,r,xx,yy,theta,Ans;
struct Point{
double x,y;Point(){}
Point(double X,double Y){x=X,y=Y;}
}point[N],tubao[N];
bool cmp1(Point a,Point b){if(abs(a.x-b.x)>eps)return a.x<b.x;return a.y<b.y;}
double cross(Point a,Point b,Point c){
return (a.x-c.x)*(b.y-c.y)-(a.y-c.y)*(b.x-c.x);
}
double dis(Point a,Point b){
return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
}
int main(){
scanf("%d%lf%lf%lf",&card,&a,&b,&r);
Ans+=*acos(-)*r;
a=a-*r,b=b-*r;
for(int i=;i<=card;i++){
scanf("%lf%lf%lf",&xx,&yy,&theta);
point[++n]=Point(xx-sin(theta)*a/-cos(theta)*b/,yy+cos(theta)*a/-sin(theta)*b/);
point[++n]=Point(xx-sin(theta)*a/+cos(theta)*b/,yy+cos(theta)*a/+sin(theta)*b/);
point[++n]=Point(xx+sin(theta)*a/-cos(theta)*b/,yy-cos(theta)*a/-sin(theta)*b/);
point[++n]=Point(xx+sin(theta)*a/+cos(theta)*b/,yy-cos(theta)*a/+sin(theta)*b/);
}
sort(point+,point++n,cmp1);
for(int i=;i<=n;i++){
while(m>&&cross(tubao[m],point[i],tubao[m-])<eps)m--;
tubao[++m]=point[i];
}k=m;
for(int i=n-;i;i--){
while(m>k&&cross(tubao[m],point[i],tubao[m-])<eps)m--;
tubao[++m]=point[i];
}
for(int i=;i<m;i++)Ans+=dis(tubao[i],tubao[i+]);
printf("%.2lf\n",Ans);
}

最新文章

  1. LeetCode 【31. Next Permutation】
  2. 使用WMI和性能计数器监控远程服务器权限设置
  3. UML学习笔记2
  4. [译]SQL Server 之 索引基础
  5. 更改Magento的base url
  6. hibernate的配置文件
  7. iPhone之Quartz 2D系列--图形上下文(2)(Graphics Contexts)
  8. Active Desktop--桌面字体背景被修改
  9. Leetcode算法刷题:217和219题 Contains Duplicate
  10. Error creating bean with name &#39;contentCategoryController&#39;: Injection of autowired dependencies failed;
  11. bootstrap-table前台和后台分页对json格式的要求
  12. OO第一阶段总结
  13. saiku中文维度,补充说明
  14. MT【314】正切比值
  15. P3420 [POI2005]SKA-Piggy Banks
  16. Spring mvc 接口枚举类型数据格式化处理
  17. 向github提交代码总是要输入用户名密码
  18. lnmp下thinkphp 500错误指南
  19. iScroll4插件的使用实例
  20. CentOS 7 安装 Nodejs npm 及版本冲突解决

热门文章

  1. LINUX-YUM 软件包升级器 - (Fedora, RedHat及类似系统)
  2. LINUX-关机 (系统的关机、重启以及登出 )
  3. 洛谷 4246 BZOJ 1018 [SHOI2008]堵塞的交通
  4. visioStudio常见问题
  5. mongodb local数据库的空间初始化好大啊!
  6. POJ 3270 置换群问题
  7. java连接数据库(经常用)
  8. Portal嵌入SAPUI5应用程序
  9. [转] python 获取本机ip地址的两种实现方法
  10. ZFS