UVA10215The Largest/Smallest Box(小数精度)

本身很容易却因为评测机有毒的一道题,,,看网上题解说最后一个答案要加一个很小的数才能AC,据说是因为没有speci judge

 1 #include <iostream>
 2 #include <string.h>
 3 #include <cstdio>
 4 #include <math.h>
 5 
 6 #define SIGMA_SIZE 26
 7 #pragma warning ( disable : 4996 )
 8 using namespace std;
 9 
10 inline int Max(int a,int b) { return a>b?a:b; }
11 inline int Min(int a,int b) { return a>b?b:a; }
12 const int inf = 0x3f3f3f3f;
13 const int maxn = 1e3+5;
14 const int mod = 10056;
15 
16 double l, w, mm = 1e-7;
17 
18 int main()
19 {
20     while ( ~scanf("%lf%lf", &l, &w) )
21     {
22         double tmp = ( (l+w) - sqrt( l*l + w*w - l*w ) )/6;;
23         double m = (l>w?w:l)/2;
24         //ans = ( l-2*tmp )*( w-2*tmp )*tmp;
25         printf( "%.3lf %.3lf %.3lf
", tmp, (double)0.0, m+mm );
26     }
27 }
原文地址:https://www.cnblogs.com/chaoswr/p/8665895.html