sicily 1441 pie
来源:互联网 发布:厦门seo陈仁潘 编辑:程序博客网 时间:2024/06/04 23:31
二分
// Submission#: 2721381// The source code is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License// URI: http://creativecommons.org/licenses/by-nc-sa/3.0/// All Copyright reserved by Informatic Lab of Sun Yat-sen University#include <cstdio>#include <algorithm>#include <cmath>using namespace std;const double pi = acos(-1.0);const int maxn = 10005;double a[maxn];int n,f;bool ok(double area){ int sum=0; for(int i=0;i<n;i++) { sum += floor(a[i] / area); } return sum>=f+1;}int main(){ int t; scanf("%d\n",&t); while(t--) { scanf("%d%d",&n,&f); double m=-1; for(int i=0;i<n;i++) { int rad; scanf("%d",&rad); a[i]=pi*rad*rad; m=max(m,a[i]); } double l,r; l=0; r=m; while(r-l>1e-6) { double mid=(l+r)/2; if(ok(mid)) { l=mid; } else { r=mid; } } printf("%.4lf\n",l); } return 0;}
0 0
- sicily 1441 pie[S]
- sicily 1441 pie
- Sicily 1441. Pie
- Sicily 1404. Hie with the Pie
- Pie
- Pie
- pie
- Pie
- Pie
- PIE
- Pie
- Pie
- Pie
- Pie
- Pie
- Pie
- pie
- Pie
- 每天一算法(三)生产着消费者问题
- HttpURLConnection与HttpClient区别及联系
- 插入排序
- 局域网内用IIS架设网站,解决本机可访问,但网内其他用户无法访问问题
- CELERY 消息队列配置
- sicily 1441 pie
- LeetCode 142 Linked List Cycle II
- 逆向笔记【贰】
- make: warning: Clock skew detected. Your build may be incomplete
- js 防止多次提交
- vlookup 的#N/A(3)
- 接受广播BroadcastReceiver
- Linux与Windows下文件传输
- freebsd+Heartbeat2+php+postgres实现数据库复制和高可用网站