Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

G=++wa c++ ac 0.o 这题有毒

Posted by Languaging at 2016-08-06 16:41:36 on Problem 3122
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<cmath>
#define PI atan(1.0)*4.0
using namespace std;
double a[10005];
double volume(double x){
    return PI*x*x;
}
int main(){
    int t,m,n;
    scanf("%d",&t);
    while(t--){
        scanf("%d%d",&m,&n);
        for(int i=0;i<m;i++)
            scanf("%lf",&a[i]);
        sort(a,a+m);
        double l=0,r=volume(a[m-1]),mid;
        while(1){
            int sum=0;
            mid=(l+r)/2;
            for(int i=0;i<m;i++)
                sum+=volume(a[i])/mid;//(int)(volume(a[i])/mid+1e-10);后者竟然是错.....
            if(sum<(n+1)) r=mid;
            else l=mid;
            if(fabs(l-r)<1e-6){
                printf("%.4lf\n",mid);
                break;
            }
        }
    }
    return 0;
}





Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator