Translate

Views

Wednesday, December 20, 2023

Solution UVA: 10678 - The Grazing Cow

 

 Problem  VerdictLangTimeBestRankSubmit Time
 | discuss10678 - The Grazing Cow AcceptedC++110.0000.000113619 secs ago





#include <bits/stdc++.h>
using namespace std;

double t, x, y, z, s;
double pi = 2*acos(0);

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    cin >> t;
    while(t--){
        cin >> y >> z;
        y /= 2;
        z /= 2;
        x = sqrt(z*z - y*y); //pitago
        s = pi * x * z;
        cout<<fixed<<setprecision(3)<<s<<"\n";
    }  

}

No comments: