Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
大牛们来看看,如此水题,怎样老是WA。#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator