#include<iostream> #include<cstdio> #include<list> #include<string> #include<cstring> #include<sstream> #include<cctype> #include<string.h> #include<algorithm> #include<cmath> #include<stack> #include<fstream> #include<cstdlib> #include<vector> #include<map> #include<set> #include<utility> #include<iomanip> #include<queue> #include<deque> #include<iterator> #include<assert.h> #include<bitset> #include<climits> #include<ctime> #include<complex> using namespace std; #define SET(a) memset(a,-1,sizeof(a)) #define ALL(a) a.begin(),a.end() #define CLR(a) memset(a,0,sizeof(a)) #define PB push_back #define PI acos(-1.0) #define max3(a,b,c) max(a,max(b,c)) #define min3(a,b,c) min(a,min(b,c)) #define READ freopen("input.txt", "r", stdin) #define WRITE freopen("output.txt", "w", stdout) #define LL long long #define S(a) scanf("%d",&a) #define S2(a,b) scanf("%d%d",&a,&b) #define KS printf("Case %d: ",kk++) #define MOD 1000000007 #define MX 100010 double vol[10010]; int n; int friends(double md) { int cnt=0; for(int i=0;i<n;i++) cnt+=(int)(vol[i]/md); return cnt; } int main() { int a,b,c,tc,w,x,y,z,m,u,v,cnt,mx,mn,p,q,r,sum; string s,s2; cin>>tc; while(tc--) { cin>>n>>m; m++; for(int i=0;i<n;i++) { cin>>vol[i]; vol[i]=(vol[i]*vol[i]*PI); } //binary search double hi=1e9,lo=0.0,md; for(int i=0;i<100;i++) { md=(hi+lo)/2.0; if(friends(md)>=m) lo=md; else hi=md; } printf("%.6lf\n",md); } return 0; }
Saturday, 2 March 2013
Uva 12097 - Pie Solution
Subscribe to:
Post Comments (Atom)
MinexWom-i Steve Schwalbe https://marketplace.visualstudio.com/items?itemName=6consceprizo.Descargar-Box--Boxing-gratuita
ReplyDeletetrananthefo
MpersviMjuncto_Clarksville Danielle Sanders click
ReplyDeletepretabraiber
YalinQinne_Gilbert Kathy Willden click here
ReplyDeletelink
link
download
raisubchata
cosa0exha Penny Brooks Install
ReplyDeleteCheck it
Check it
odadntegmye
Oticelfrig_bi-Springfield Melanie Mccallister there
ReplyDeletesoftware
pitslagardsa