Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
Register

## 16ms今天好高兴

Posted by 2008161035 at 2009-10-31 00:00:31 on Problem 1654
```#include "iostream"
#include "string.h"
using namespace std;

struct p
{
int x,y;
};

int square(p a,p b,p c)
{
int r = (b.x-a.x)*(c.y-b.y)-(b.y-a.y)*(c.x-b.x);
return r;
}

int main()
{
freopen("in.txt","r",stdin);
freopen("out.txt","w",stdout);
int n;
int move[10][2]={{0,0},{-1,-1},{0,-1},{1,-1},{-1,0},{0,0},{1,0},{-1,1},{0,1},{1,1}
};
scanf("%d",&n);
char ch[1000100];
while(n--)
{
scanf("%s",ch);
int len = strlen(ch);
int i,j,k;
p a,b,c;
a.x=0,a.y=0;
c.x=a.x+move[ch[0]-'0'][0];
c.y=a.y+move[ch[0]-'0'][1];

__int64 s =0;
for(i=1;i<len;i++)
{
b=c;
c.x=b.x+move[ch[i]-'0'][0];
c.y=b.y+move[ch[i]-'0'][1];
s+=square(a,b,c);
}
if(s<0)s=-s;
printf("%I64d",s/2);
if(s%2)
printf(".5");
printf("\n");

}
return 0;
}
```

Followed by: