-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1178 - Trapezium.cpp
53 lines (51 loc) · 1.26 KB
/
1178 - Trapezium.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
42
43
44
45
46
47
48
49
50
51
52
53
/**
* Author: Ashraful Islam Rafi
* University: Leading University,Sylhet
* url: http://lightoj.com/volume_showproblem.php?problem=1178
* problem: 1178 - Trapezium
* complexity: Geomatry
* site: Lightoj.com
**/
#include"map"
#include"set"
#include"queue"
#include"cmath"
#include"stack"
#include"ctype.h"
#include"cstdio"
#include"vector"
#include"stdio.h"
#include"cstring"
#include"cstdlib"
#include"string.h"
#include"iostream"
#include"algorithm"
using namespace std;
#define cs "Case "<<++casee<<": "
#define csE "Case "<<++casee<<":\n"
#define sf(t) scanf("%d",&t)
#define sNE(n,e) scanf("%d %d",&N,&E)
#define Inf 1000000000
#define S_N 5000010
#define MST(a, tf) memset(a, tf, sizeof (a))
#define pi acos(-1.0)
#define eps 1e-9
using namespace std;
#define csnl "Case "<<kase++<<":"<<endl;
#define cs "Case "<<kase++<<": "
#define sf(input) scanf("%d", &input)
#define set(value, array) memset(array, value, sizeof array);
int main()
{
int t; sf(t);
int casee=0;
while(t--)
{
double a, b, c, d, e; cin >> a >> b >> c >> d;
double n = sqrt( (a + b + d - c) * ( c - a + b + d) * (c - a + b - d) * ( c - a - b + d));
double height = n / ( 2 * ( c - a) );
double area = 0.5 * (a + c) * height;
area = abs(area);
printf("Case %d: %.10lf\n", ++casee,area);
}
}