LA4356
来源:互联网 发布:网络词钵钵鸡什么意思 编辑:程序博客网 时间:2024/05/16 03:33
la上不去了,给杭电的链接:
http://acm.hdu.edu.cn/showproblem.php?pid=2469
要去上课了,题解先不写了- -
#include <iostream>#include <cmath>#include <algorithm>#include <vector>#include <cstdio>using namespace std;#define pi acos(-1.0)typedef struct point{ int x, y; int r; double theta;} p;bool operator <(p a,p b){ return a.theta < b.theta;}int main(){ ios::sync_with_stdio(false); int N,K; int count_of_case = 0; while(cin>>N>>K && (N || K)) { int t = N; vector<p> a; p temp; while(t--) { cin>>temp.x>>temp.y; temp.r = temp.x*temp.x + temp.y*temp.y; temp.theta = atan2((double)temp.y,(double)temp.x); a.push_back(temp); } if(!K) { printf("Case #%d: 0.00\n",++count_of_case); continue; } sort(a.begin(),a.end()); double ans = 1 << 30; double angle; double b[5000]; printf("Case #%d: ",++count_of_case); for(int i=0; i<N; i++) { int n=0; for(int j=0; j<N; j++) { if(a[j].r<=a[i].r) { b[n++]=a[j].theta; } } if(n<K) { continue; } for(int j=0, k = K - 1; j<n; j++,k++) { if(k<n) { angle=b[k]-b[j]; } else { angle=b[k-n]-b[j]+pi*2; } ans=min(ans,.5*angle*a[i].r); } } printf("%.2f\n",ans); }}
- LA4356
- LA4356 Fire-Control System
- org.hibernate.NonUniqueResultException: query did not return a unique result: 2
- 从零开始学建站-域名篇
- 反转单链表--迭代和递归分别实现
- ubifs- B+ Tree
- 2013年3月山西综合性网站及社区网站 综合影响力排名
- LA4356
- 骨骼动画导论 ok
- 程序猿的烦恼,你还会坚持吗?
- Dynamo 以及一致性哈希简介
- 为什么要使用NoSQL?NOSQL的优势
- 搜狗想要卖,很难过政府审批那关
- xmlhttp:open方法
- 判断点在多边形内
- 文件描述符&write函数的使用