UVA 11152 Colourful Flowers Solution
Solve in C++:
//AH Tonmoy
//Department of CSE ,Islamic University
#include <bits/stdc++.h>
using namespace std;
int main()
{
int a,b,c;
double rs,rr,ra,vio,ros,asun,va,as,s;
while(cin>>a>>b>>c)
{
s=(a+b+c)/2.0;
vio=sqrt(s*(s-a)*(s-b)*(s-c));
rs=(a*b*c)/(4*vio);
as=rs*rs*acos(-1);
asun=as-vio;
rr=vio/s;
ra=rr*rr*acos(-1);
va=vio-ra;
printf("%.4lf %.4lf %.4lf\n",asun,va,ra);
}
return 0;
}
//AH Tonmoy
//Department of CSE ,Islamic University
#include <bits/stdc++.h>
using namespace std;
int main()
{
int a,b,c;
double rs,rr,ra,vio,ros,asun,va,as,s;
while(cin>>a>>b>>c)
{
s=(a+b+c)/2.0;
vio=sqrt(s*(s-a)*(s-b)*(s-c));
rs=(a*b*c)/(4*vio);
as=rs*rs*acos(-1);
asun=as-vio;
rr=vio/s;
ra=rr*rr*acos(-1);
va=vio-ra;
printf("%.4lf %.4lf %.4lf\n",asun,va,ra);
}
return 0;
}
No comments