forked from sitz/UVa-Online-Judge
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path10429.cpp
41 lines (39 loc) · 947 Bytes
/
10429.cpp
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
#include <bits/stdc++.h>
using namespace std;
const double PI = atan(1) * 4;
int kase = 1;
double px, py, txy;
char str[20];
int main()
{
int i = 0;
while (scanf("%lf %lf %lf", &px, &py, &txy) != EOF)
{
if (i > 0)
{
printf("\n");
}
if (fabs(txy) >= 1e-12)
{
scanf("%s", str);
if (!strcmp(str, "CCW"))
{
txy *= -1.0;
}
}
double r;
r = sqrt((px - py) * (px - py) + 4.0 * txy * txy) / 2.0;
double oc, angle;
oc = (px + py) / 2.0;
angle = acos((px - oc) / r) / 2.0;
angle = angle * 180 / PI;
printf("Element : %d\n", kase++);
printf("Position of maximum normal stresses : %.2lf deg\n", angle);
printf("Maximum normal stresses : %.2lf MPa and %.2lf MPa\n\n", oc + r, oc - r);
printf("Position of maximum shear stresses : %.2lf deg\n", angle + 45);
printf("Maximum shear stress (xy plane) : %.2lf MPa\n", r);
printf("Normal stress at this condition : %.2lf MPa\n", oc);
i++;
}
return 0;
}