Reform Spring breeze blowing everywhere
Time limit:2000/1000 MS (java/others) Memory limit:65536/32768 K (java/others)
Total submission (s): 22698 Accepted Submission (s): 11741
Problem Description "Reform spring breeze blowing everywhere,
no AC okay;
I really can't go back to my hometown
There is another acre of land.
Thank you! (band playing) "
Saying that some students are very good mentality, every day to know the game, the exam is so simple topic, but also foggy, but also to such a few limerick.
Well, the teacher's responsibility is to help you solve the problem, since you want to farm, it will be a piece of you.
This field is located in Wenzhou Cangnan County, Zhejiang Province Ling Xi Zhen Forest Home Shop village, polygon shape of a piece of land, originally Linle, now ready to give you. However, nothing is so simple, you must first tell me how much area the land is, and if the answer is correct, you can really get the land.
Are you worried? is to let you know, the farming also needs AC knowledge! After the good practice it ...
Input data contains multiple test instances, one row per test instance, and the beginning of each line is an integer n (3<=n<=100), which represents the number of sides of the polygon (and, of course, the number of vertices), followed by the coordinates of n vertices given in counter-clockwise order (x1, y1, x2, y2 Xn, yn), in order to simplify the problem, all coordinates here are represented by integers.
All integers in the input data are within a 32-bit integer range, and n=0 represents the end of the data and does not handle it.
Output for each test instance, print the corresponding polygon area, and the result is exactly one decimal after the decimal point.
The output for each instance takes up one row.
Sample INPUT3 0 0 1 0 0 14 1 0 0 1-1 0 0-10
Sample Output0.52.0
#include <stdio.h>int main () {int n,m,j,i,s;double sum;double a[110],b[110];while (scanf ("%d", &n), N) {for (i= 0;i<n;i++) {scanf ("%lf%lf", &a[i],&b[i]);} A[n]=a[0];b[n]=b[0];sum=0;for (i=1;i<=n;i++) sum+=a[i-1]*b[i]-a[i]*b[i-1];p rintf ("%.1lf\n", SUM/2);} return 0;}
Hdoj 2036 reform Spring breeze blowing everywhere