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

我用的是四个空格啊,怎么还PRESENTATION ERROR?

Posted by BlueBlood at 2005-01-23 10:18:45 on Problem 1653
#include <iostream>
#include <stdlib.h>
#include <cstdio>
#include <cmath>

using namespace std;

//presentation error
int main(int argc, char *argv[])
{
  int n,t=0;
  cin>>n;

  short **a= new short* [n];
  short **b= new short* [n];
  int i,j;
  
   for ( i =0;i < n;i++)
  {
      a[i] = new short [51];
      b[i] = new short [51];
      
      for ( j = 0 ;j < 51;j++)
         a[i][j] = b[i][j] = 0;
         
      a[0][1] =1;
      b[0][1] = 1;
  }    
  
  int carry;
  while ( t<=n )
  {      
      if ( t%2 == 0 )
      {
          for ( i = 1;i < t;i++)
          {
              carry = 0;
              
              for ( j= 1; j < 50;j++)
              {
                  b[i][j] = a[i][j]+a[i-1][j]+carry;
                  if ( b[i][j] > 9)
                  {
                      b[i][j] %=10;
                      carry =1;
                  }    
                  else 
                      carry = 0;
              }    
              
          }  
          
          for ( i = 0;i< t;i++)
          {
              j = 50;
              while ( b[i][j] == 0 && j>0 ) j--;
              for (;j > 0 ;j--)
                  printf("%d",b[i][j]);
              printf("    ");
          } 
		  t++;
          cout<<endl;   
		  continue;
      }    
      
      if ( t %2== 1 )
      {
          for ( i = 1;i < t ;i++)
          {
              carry = 0;
              
              for ( j= 1; j < 50;j++)
              {
                  a[i][j] = b[i][j]+b[i-1][j]+carry;
                  if ( a[i][j]  > 9)
                  {
                      a[i][j] %=10;
                      carry =1;
                  }    
                  else 
                      carry = 0;
              }    
              
          }  
         
          for ( i = 0;i< t;i++)
          {
              j = 50;
              while ( a[i][j] == 0 && j >0) j--;
              for (;j > 0 ;j--)
                  printf("%d",a[i][j]);
              printf("    ");
          }  
		   t++;
          cout<<endl; 
		  continue;
      }    
  }        
   
 
  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