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

Re:1001为什么我在自己电脑测试正确,而它总说我wrong answer呢

Posted by aduck at 2008-04-23 12:16:38 on Problem 1001
In Reply To:1001 为什么我总是wrong answer请大虾指点 Posted by:fujin at 2008-04-05 10:01:42
#include <stdio.h>
void main()
 {
     int a[6][10],n[6],x[150],y[150];
     int i,j,k,l,point[6];
     for(i=0;i<1;i++)
       {
           for(j=0;j<10;j++) {a[i][j]=getchar();a[i][j]=a[i][j]-48;}
           if(a[i][7]!=-16) n[i]=a[i][7]*10+a[i][8];
           else n[i]=a[i][8];
           if(a[i][1]==-2)  {point[i]=4*n[i];for(k=1;k<5;k++) a[i][k]=a[i][k+1];}
           else             {point[i]=3*n[i];for(k=2;k<5;k++) a[i][k]=a[i][k+1];}
       }
     for(i=0;i<1;i++)
      {
         for(j=0;j<5;j++) {x[j]=a[i][j];y[j]=0;}
         for(l=2;l<=n[i];l++)
           {
           for(j=4;j>=0;j--)
             {
                for(k=(l-1)*5-1;k>=0;k--)
                  {
                     y[1+k+j]=a[i][j]*x[k]+y[1+k+j];
                  }
                 y[0]=0;
             }
           for(j=l*5-1;j>0;j--)
             {
                 y[j-1]=y[j]/10+y[j-1];
                 x[j]=y[j]%10;
             }
           x[0]=y[0];
           for(j=0;j<l*5;j++) y[j]=0;
           }
         j=0;
         for(l=0;l<n[i]*5-point[i];l++)
           {
              if(x[l]!=0||j==1) {printf("%d",x[l]);j=1;}
           }
          j=0;
         for(l=n[i]*5-1;l>=n[i]*5-point[i];l--)
           {
               if(x[l]==0) j=j+1;
               else break;
           }
         if(j!=point[i]) printf(".");
         for(l=n[i]*5-point[i];l<n[i]*5-j;l++) printf("%d",x[l]);
         printf("\n");
      }
 }

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