Frog Wa has many frogs, so he can hear GuaGuaGua every day. But one day a flappy bird ate his frogs, so Frog Wa decided to build a fence to protect his precious frogs. Frog Wa told you four points (x, 0), (x, y), (z, 0), (z, t) which represent for the vertex of the fence. he want to know the area of the fence, can you tell him?
Input
The input consist of four integers x, y, z and t. 0 <= x, y, z, t <= 10000, x < z and y < t.
Output
For each test case, print the area, numbers should accurate to one decimal places.
Sample Input
1 1 2 2
0 2 6 6
0 0 2 10
Sample Output
1.5
24.0
10.0
Hint
无
代码
#include<stdio.h>
int main()
{
int x,y,z,t;
double s;
while(scanf("%d%d%d%d",&x,&y,&z,&t)!=EOF)
{
if(x>=0&&x<=10000&&y>=0&&y<=10000&&z>=0&&z<=10000&&t>=0&&t<=10000)
{
s=(y+t)*(z-x)*1.0/2;
printf("%.1f\n",s);
}
else
break;
}
return 0;
}
新生赛002 j题
最新推荐文章于 2024-05-03 21:28:54 发布