当前位置:网站首页>Hdu-2036-reform spring breeze blowing all over the ground (polygon area template)
Hdu-2036-reform spring breeze blowing all over the ground (polygon area template)
2022-07-28 06:51:00 【__ Simon】
The spring breeze of reform is sweeping the ground
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 30103 Accepted Submission(s): 15517
Can't AC No problem ;
I can't go back to my hometown ,
And a third of an acre .
thank you !( The band plays )”
In other words, some students have excellent mentality , I know the game every day , This is such a simple test , It's also in the clouds , and , Even so many Doggerels .
Okay , The teacher's responsibility is to help you solve problems , Since you want to farm , Then share it with you .
This field is located in linjiapuzi village, Lingxi Town, Cangnan County, Wenzhou City, Zhejiang Province , A polygon shaped piece of land , It was linle Of , I'm ready to give it to you now . however , Nothing is that simple , You must first tell me the area of this land , If you answer correctly, you can really get this land .
Worry ? Just to let you know , Farming is also needed AC Knowledgeable ! You'd better practice hard in the future ...
All integers in the input data are in 32 Bit integer range ,n=0 Indicates the end of the data , Don't deal with it .
The output of each instance takes up one line .
3 0 0 1 0 0 1 4 1 0 0 1 -1 0 0 -1 0
0.5 2.0
#include <cstdio>
struct Lpoint{
double x;
double y;
}plg[110];// Counterclockwise polygon vertex set
double areaofp(int vcount,Lpoint plg[]){
int i;
double s;
if(vcount<3) return 0;
s=plg[0].y*(plg[vcount-1].x-plg[1].x);
for(i=1;i<vcount;i++){
s+=plg[i].y*(plg[i-1].x-plg[(i+1)%vcount].x);
}
return s/2;
}
int main(){
int n,i;
while(scanf("%d",&n),n){
for(i=0;i<n;i++){
scanf("%lf%lf",&plg[i].x,&plg[i].y);
}
printf("%.1f\n",areaofp(n,plg));
}
return 0;
}
边栏推荐
猜你喜欢

单元测试框架Jest搭配TypeScript的安装与配置

Two dimensional array practice: spiral matrix

How to calculate the size of structure, segment and Consortium (common body)

Analysis of the semaphore source code of AQS

Which is the best and most cost-effective air conduction headset recommended

Redis implementation of distributed lock and analysis of the main process of redismission distributed lock

2022 Tanabata gift recommendation! Nice, cheap and practical gift recommendation

What's a good gift for Tanabata? Niche and advanced product gift recommendation

Graphic pipeline foundation (part outside)

Battle plague Cup -- strange shape
随机推荐
It is recommended to wear air conduction earphones, which do not need to wear in ear
[C language] string library function introduction and simulation
技术分享 | 使用 cURL 发送请求
Which is the best air conduction Bluetooth headset? Air conduction Bluetooth headset ranking
QT使用MSVC编译器输出中文乱码问题
KVM热迁移
Mongodb quick start
如何描述一个BUG以及BUG级别的定义、生命周期
Dynamic planning -- multi-step stair climbing (advanced version of stair climbing)
What is the most practical gift for Tanabata? A gift that will never go wrong is worth buying
redis缓存设计与性能优化
Graphic pipeline foundation (part outside)
Elastic common high frequency commands
Source code analysis of countdownlatch of AQS
redis实现分布式锁思路及redission分布式锁主流程分析
HDU-5805-NanoApe Loves Sequence(思维题)
Initializingbean interface and examples
数组转链表
JS variable is equal to 0, etc. '
技术分享 | 使用postman发送请求