杭电 2036

#include "stdio.h"

typedef struct kks 
{
    int x;
    int y;
}lists;

int main(int argc, char* argv[])
{
    int index;
    lists ms[101];
    while (scanf("%d",&index))
    {
        if (index == 0 )
        {
            break;
        }
        else
        {
            for (int i = 0 ; i < index ; ++i )
            {
                scanf("%d%d",&ms[i].x ,&ms[i].y);
            }
            double m = 0;
            m = ms[index-1].x * ms[0].y - ms[index-1].y * ms[0].x ;
            for ( i = 0 ; i < index - 1 ; ++i )
            {
                m += ms[i].x * ms[i+1].y - ms[i].y * ms[i+1].x;
            }
            m = m / 2 ;
            printf("%.1f\n",m);
        }
    }
    return 0;
}


 

你可能感兴趣的:(struct,include)