当前位置:网站首页>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;
}
边栏推荐
- [dynamic planning -- the best period for buying and selling stocks series 3]
- Dynamic memory management function of C language
- KVM hot migration
- Graphic pipeline foundation (part outside)
- [C language] string library function introduction and simulation
- 网络——网络层
- Rain Scene Effect (I)
- How to store floating point data in memory
- How to calculate the size of structure, segment and Consortium (common body)
- Skimming records -- sequence traversal of binary tree
猜你喜欢

What is the most practical gift for Tanabata? A gift that will never go wrong is worth buying

Skimming records -- sequence traversal of binary tree

explain详解

redis实现分布式锁思路及redission分布式锁主流程分析

技术分享 | 如何模拟真实使用场景?mock 技术来帮你

Battle plague Cup -- strange shape

mysql-8.0.17-winx64(附加navicat)手动配置版安装

Dynamic memory management function of C language

Two dimensional array practice: spiral matrix

mysql索引优化
随机推荐
What is the good brand of air conduction Bluetooth headset and the best brand recommendation of air conduction headset
Leetcode brush question diary sword finger offer II 055. binary search tree iterator
Ubuntu18.04搭建redis集群【学习笔记】
KVM热迁移
Dynamic planning -- multi-step stair climbing (advanced version of stair climbing)
It is recommended to wear air conduction earphones, which do not need to wear in ear
Mongo SSL configuration practice
链表中结点的插入和删除
@PostConstruct注解及用处示例
QGraphicsView提升为QChartView
How to simulate the implementation of strcpy library functions
Dynamic memory management function of C language
Mongodb replica set and partitioned cluster
SSAO by computer shader (III)
[dynamic planning -- the best period series for buying and selling stocks]
Which is the best air conduction Bluetooth headset? Air conduction Bluetooth headset ranking
Rain Scene Effect (I)
数组转链表
Water rendering example
手把手教你三步完成测试监控系统搭建