多边形面积
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
using namespace std;
typedef struct point{
__int64 x,y;
point(__int64 nx=0,__int64 ny=0):x(nx),y(ny){
}
}vector;
__int64 cross(vector a,vector b){
return a.x*b.y-a.y*b.x;
}
int main(){
int dx[]={0,-1,0,1,-1,0,1,-1,0,1};
int dy[]={0,-1,-1,-1,0,0,0,1,1,1};
int t,k;
char ch;
__int64 area=0;
vector p1,p2;
scanf("%d",&t);
while(t--){
area=0;
scanf("%c",&ch);
while(ch!='5'){
k=ch-'0';
p2.x=p1.x+dx[k];p2.y=p1.y+dy[k];
area+=cross(p1,p2);
//printf("%I64d\n",area);
p1=p2;
scanf("%c",&ch);
}
p1.x=p1.y=0;
area+=cross(p2,p1);
//printf("%I64d\n",area);
if(area < 0)
area = -area;
if(area &1)
printf("%I64d.5\n", area/2);//
else
printf("%I64d\n", area/2);
}
return 0;
}