/****************************************** Mobarak Hosen Shakil ICE, Islamic University ID: mhiceiuk(all), 29698(LOJ) E-mail: mhiceiuk @ (Gmail/Yahoo/FB) Blog: https://iuconvergent.wordpress.com *******************************************/ #include<bits/stdc++.h> using namespace std; #define IOS ios_base::sync_with_stdio(0);cin.tie(0) #define LL long long int #define ULL unsigned LL const int inf=1<<30; const LL INF=1e18; const int MOD=1e9+7; double Volume(double l, double w, double h) { return ((l-2*h)*(w-2*h)*h); } int main() { int tn; scanf("%d", &tn); for(int i=1; i<=tn; i++) { double a, b, c, l, w, h; scanf("%lf%lf", &l, &w); a = 12.0; b = -4 * (l+w); c = (l*w); h = (- b - sqrt(b*b - 4*a*c))/(2.0*a); printf("Case %d: %.10lf\n", i, Volume(l, w, h)); } return 0; }
Leave a comment