标签:
1 #include<stdio.h> 2 #include<iostream> 3 #include<math.h> 4 #include<algorithm> 5 using namespace std; 6 double a[4]; 7 bool check(long long b) 8 { 9 if(b-a[3]>=a[2]) 10 return true; 11 return false; 12 } 13 int main() 14 { 15 double maxn,minn,mid; 16 int t=0; 17 while(cin>>a[0]>>a[1]>>a[2]>>a[3]) 18 { 19 t++; 20 sort(a,a+4); 21 minn=sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]+a[3]*a[3]); 22 maxn=a[3]*2; 23 while(minn+0.1<maxn) 24 { 25 mid=(minn+maxn)/2; 26 if(check(mid))maxn=mid; 27 else minn=mid; 28 } 29 printf("Case %d: %.0lf\n",t,minn); 30 } 31 return 0; 32 }
标签:
原文地址:http://www.cnblogs.com/Annetree/p/5674653.html