新生赛002 j题

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;
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值