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

## Re:测试好多数据都对了为什么还WA啊.....................

Posted by liurui39660 at 2016-05-06 16:53:58 on Problem 1654
In Reply To:测试好多数据都对了为什么还WA啊..................... Posted by:h879122659 at 2013-01-13 17:28:43
```> #include<stdio.h>
> #include<stdlib.h>
> #include<math.h>
> struct Point{
>        int x;
>        int y;
> }point[1000000+100];
> char str[1000000+100];
>
> main()
> {
>       int t,i;
>       long long j,count=0,k;
>       long long s=0;
>
>
>       scanf("%d",&t);
>       for(i=1;i<=t;i++){
>           scanf("%s",str);
>           point[0].x=0;
>           point[0].y=0;
>           count=0;
>           for(k=1,j=0;str[j]!='5';j++,k++){
>               count++;
>               if(str[j]=='8'){
>                   point[k].x=point[k-1].x;
>                   point[k].y=point[k-1].y+1;
>               }
>               if(str[j]=='2'){
>                   point[k].x=point[k-1].x;
>                   point[k].y=point[k-1].y-1;
>               }
>               if(str[j]=='6'){
>                   point[k].x=point[k-1].x+1;
>                   point[k].y=point[k-1].y;
>               }
>               if(str[j]=='4'){
>                   point[k].x=point[k-1].x-1;
>                   point[k].y=point[k-1].y;
>               }
>               if(str[j]=='9'){
>                   point[k].x=point[k-1].x+1;
>                   point[k].x=point[k-1].y+1;
>               }
>               if(str[j]=='7'){
>                   point[k].x=point[k-1].x-1;
>                   point[k].y=point[k-1].y+1;
>               }
>               if(str[j]=='3'){
>                   point[k].x=point[k-1].x+1;
>                   point[k].y=point[k-1].y+1;
>               }
>               if(str[j]=='1'){
>                   point[k].x=point[k-1].x-1;
>                   point[k].y=point[k-1].y-1;
>               }
>           }
>           s=0;
>           if(count<=1)  printf("0\n");
>           else{
>                for(k=1;k<=count;k++){
>                     s=s+point[k].x*point[k+1].y-point[k].y*point[k+1].x;
>                }
>                s=abs(s);
>                if(s%2==0) printf("%lld\n",s/2);
>                else{
>
>
>                    printf("%1ld.5\n",s/2);
>                }
>           }
>       }
>             return 0;
> }

Followed by: