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

我也在TJU通过了,这儿通过不了。到底格式要注意什么啊,题目不是说的很清楚了吗?我是按照题目来的,怎么还会错?

Posted by yygy at 2014-03-13 14:15:55 on Problem 1224
In Reply To:why WA? Posted by:rouder at 2006-01-10 16:32:28
> I don't know why. I got AC at UVa and TJU
> 
> Source
> 
> Problem Id:1224  User Id:rouder
> Memory:64K  Time:46MS
> Language:G++  Result:Wrong Answer
> 
>     * Source
> 
> #include<stdio.h>
> int n;
> int a[12][3];
> char b[12][5][5];
> int found;
> int v[12];
> int v2[5][5];
> int sum[5][5];
> int op[5]={2, 3, 0, 1};
> void f1(int x, int y)
> {
>     if(y==4){x++; y=1;}
>     if(x==4)
>     {
>         int i, j;
>         for(i=1;i<=3;i++)
>         {
>             for(j=1;j<=3;j++) printf("   %s   ", b[v2[i][j]][sum[i][j]]);
>             printf("\n");
>             for(j=1;j<=3;j++) printf("%s %s %s ", b[v2[i][j]][(sum[i][j]+3)%4], a[v2[i][j]], b[v2[i][j]][(sum[i][j]+1)%4]);
>             printf("\n");
>             for(j=1;j<=3;j++) printf("   %s   ", b[v2[i][j]][(sum[i][j]+2)%4]);
>             printf("\n\n");
>         }
>         found=1;
>         return;
>     }
>     int i, k;
>     int p1, p2;
>     for(i=1;i<=9;i++)
>     {
>         if(v[i]==1) continue;
>         p1=v2[x][y-1];
>         p2=v2[x-1][y];
>         for(k=0;k<=3;k++)
>         {
>             if(y>1)
>             {
>                 if(b[p1][(sum[x][y-1]+1)%4][0]!=b[i][(k+3)%4][0] || b[p1][(sum[x][y-1]+1)%4][1]+b[i][(k+3)%4][1]!='L'+'R')
>                     continue;
>             }
>             if(x>1)
>             {
>                 if(b[p2][(sum[x-1][y]+2)%4][0]!=b[i][k][0] || b[p2][(sum[x-1][y]+2)%4][1]+b[i][k][1]!='L'+'R')
>                     continue;
>             }
>             v[i]=1;
>             v2[x][y]=i; sum[x][y]=k;
>             f1(x, y+1);
>             v[i]=0;
>             if(found==1) return;
>         }
>     }
> }
> int main()
> {
>     int t;
>     int i;
>     while(1)
>     {
>         scanf("%d", &t);
>         if(t==0) break;
>         for(i=1;i<=9;i++)
>         {
>             scanf("%s %s %s %s %s", a[i], b[i][0], b[i][1], b[i][2], b[i][3]);
>             v[i]=0;
>         }
>         found=0;
>         printf("%d:\n", t);
>         f1(1, 1);
>         if(found==0) printf("No Solution\n");
>         printf("\n");
>     }
>     return 0;
> }
> 

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator