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

大牛们来看看,如此水题,怎样老是WA。

Posted by wklove at 2008-09-28 21:03:34 on Problem 1028
#include<iostream>
#include<string>
using namespace std ;

string str[120] ;
int k = 0 , length = 0 ;

int main()
{
        //freopen( "1028.txt" , "r" , stdin ) ;
        str[0] = "http://www.acm.org/" ;
        
        while( 1 )
        {
                string str1 = "" ;
                int len = 0 ;
                char chr[100] ;
                gets( chr ) ;
                int i = 0 ;
                if( chr[0] == 'V' )
                {     
                        len = strlen( chr ) ;
                        for( i = 6 ; i <= len ; i++ )
                                str1 += chr[i] ;
                        str[++k] = str1;
                        length = k ;
                        cout << str1 << endl ;
                }
                
                if( chr[0] == 'B' )
                {
                          --k ;
                          if( k < 0 )
                          {
                                  cout << "Ignored" << endl ;
                                  ++k;
                          }
                          else
                                  cout << str[k] << endl ;           
                }
                
                if(chr[0] == 'F')
                {
                       ++k ;
                       if(k > length)
                       {
                               cout << "Ignored" << endl ;
                               --k ;
                       }
                       else
                               cout << str[k] << endl ;
                }
                
                if( chr[0] == 'Q' )
                        break;
        }
        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