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

ac,贴代码,180K 16MS

Posted by liduoldbiubiubiu at 2020-01-15 19:19:15 on Problem 1028
#include <string>
#include <iostream>
using namespace std;
string s[201];
int main(){
    s[0] = "http://www.acm.org/";
    int i=0,end=0;
    while(true){
        string c;
        cin>>c;
        if(c == "QUIT"){
            break;
        }
        if(c =="BACK"){
            if(i==0){
                cout<<"Ignored"<<endl;
                continue;
            }else{
                i--;
                cout<<s[i]<<endl;
            }
        }else if(c=="FORWARD"){
            if(i==end){
                cout<<"Ignored"<<endl;
                continue;
            }else{
                i++;
                cout<<s[i]<<endl;
            }
        }else{//visit
            string url;
            cin>>url;
            cout<<url<<endl;
            i++;
            s[i]=url;
            end=i;
        }

    }
    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