include stdio include math using namespace std typedef unsigned int ui

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include <stdio.h>
#include <math.h>
using namespace std;
typedef unsigned int uint;
int main()
{
FILE * in, * out;
in = fopen("amphitheatre.in", "r");
out = fopen("amphitheatre.out", "w");
uint k0 = 0, l0 = 0, r0 = 0, sw = 0;
fscanf(in, "%d %d %d", &k0, &l0, &r0);
if (l0 < k0)
{
sw = k0;
k0 = l0;
l0 = sw;
}
long double k = k0 + 1, l = l0 + 1, r = r0, d = r0 * 2, a = 0.0, b = 0.0, s = 0.0;
if (k0 == 1)
{
if (l0 & 1)
{
a = 0;
b = d / l;
}
else
{
a = - (r / l);
b = r / l;
}
s = 0.5 * (r * r * (acos(a/r) - acos(b/r)) + (b * sqrt(r*r - b*b)) - (a * sqrt(r*r - a*a)));
}
else
{
s = (d / k) * (d / l);
}
fprintf(out, "%.6Lf", s);
fclose(in);
fclose(out);
return 0;
}