LightOJ 1331 - Agent J
//Next Codeforces Round #354 (Div. 2)
#include<bits/stdc++.h>
//#include<cstdio>
//#include<iostream>
//#include<algorithm>
//#include<vector>
//#include<cstring>
//#include<cmath>
//#include<map>
using namespace std;
#define fast ios_base::sync_with_stdio(false)
#define bfast cin.tie(0)
#define outs(x) cout << x << " "
#define outn(x) cout << x << "\n"
#define sf scanf
#define pf printf
#define nl puts("")
//#define i64 long long
#define pi acos(-1.0)
typedef long long LL;
typedef vector<int>vii;
typedef vector<LL>vll;
int main()
{
fast;
int t, tc=0;
double r1, r2, r3 , triangle_area , area_setors , a , b , c , s, area_sector_A , area_sector_B, area_sector_C, A , B , C;
//cin >> t;
sf("%d", &t);
while(t--)
{
//cin >> r1 >> r2 >> r3;
sf("%lf %lf %lf", &r1, &r2, &r3);
a = r2 + r3;
b = r1 + r3;
c = r1 + r2;
A = acos((b * b + c*c - a*a) / (2.0 * (b * c)));
B = acos((a * a + c*c - b*b) / (2.0 * (a * c)));
C = acos((a * a + b*b - c*c) / (2.0 * (a * b)));
s = ( a + b + c) * 0.5;
triangle_area = sqrt(s * (s - a) * (s - b) * (s - c));
area_sector_A = (A * r1*r1) * 0.5;
area_sector_B = (B * r2*r2) * 0.5;
area_sector_C = (C * r3*r3) * 0.5;
area_setors = area_sector_A + area_sector_B + area_sector_C;
pf("Case %d: %.8lf\n" , ++tc, triangle_area - area_setors);
}
return 0;
}
#include<bits/stdc++.h>
//#include<cstdio>
//#include<iostream>
//#include<algorithm>
//#include<vector>
//#include<cstring>
//#include<cmath>
//#include<map>
using namespace std;
#define fast ios_base::sync_with_stdio(false)
#define bfast cin.tie(0)
#define outs(x) cout << x << " "
#define outn(x) cout << x << "\n"
#define sf scanf
#define pf printf
#define nl puts("")
//#define i64 long long
#define pi acos(-1.0)
typedef long long LL;
typedef vector<int>vii;
typedef vector<LL>vll;
int main()
{
fast;
int t, tc=0;
double r1, r2, r3 , triangle_area , area_setors , a , b , c , s, area_sector_A , area_sector_B, area_sector_C, A , B , C;
//cin >> t;
sf("%d", &t);
while(t--)
{
//cin >> r1 >> r2 >> r3;
sf("%lf %lf %lf", &r1, &r2, &r3);
a = r2 + r3;
b = r1 + r3;
c = r1 + r2;
A = acos((b * b + c*c - a*a) / (2.0 * (b * c)));
B = acos((a * a + c*c - b*b) / (2.0 * (a * c)));
C = acos((a * a + b*b - c*c) / (2.0 * (a * b)));
s = ( a + b + c) * 0.5;
triangle_area = sqrt(s * (s - a) * (s - b) * (s - c));
area_sector_A = (A * r1*r1) * 0.5;
area_sector_B = (B * r2*r2) * 0.5;
area_sector_C = (C * r3*r3) * 0.5;
area_setors = area_sector_A + area_sector_B + area_sector_C;
pf("Case %d: %.8lf\n" , ++tc, triangle_area - area_setors);
}
return 0;
}
Comments
Post a Comment