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

哪里错了?

Posted by BlueBlood at 2005-01-15 19:08:44 on Problem 1653
#include <iostream.h>
#include <stdlib.h>
#include <stdio.h>
 


int main(int argc, char *argv[])
{
 
	 int n;
	 int i,j;
	 cin>>n;
	 
	 int * a=new int[n];
	 int * b=new int[n];
	 a[0] = 1;a[1]= 1;
	 int p= 0 ;
	 while ( p < n) 
     {
         if ( p== 0 )
         {
         cout<<a[0]<<endl;
         p++;
         continue;
     }    
      if ( p == 1)
     {
         for ( i = 0 ; i  < 2 ;i++)
             cout<<1<<"    ";
             cout<<endl;
             p++;
               continue;
          }    
         if ( p % 2 == 0 && p != 0)
         {
             b[0] = 1;
             for ( i = 1 ;i <= p ; i ++ )
                b[i] = a[i-1]+a[i];
             p++;
             for ( i = 0 ; i <  p ; i++)
             cout<<b[i]<<"    ";
             cout<<endl;
               continue;
         }    
         if ( p % 2 == 1 && p != 1 )
         {
             for ( i = 1 ;i <= p ; i ++ )
                a[i] = b[i-1]+b[i];
             p++;
             for ( i = 0 ; i <p ; i++)
             cout<<a[i]<<"    ";
             cout<<endl;
               continue;
         }       
     }    
   
    // system("PAUSE");
  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