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的没道理 手机交题不容易啊 浪费1个多小时宝贵的时间

Posted by gjl87910lq at 2009-05-31 21:41:52 on Problem 1028
完全wa的没有道理

第一个程序
#include <iostream>
#include <string>

using namespace std;

int main()
{
    int point=0;
    string url[150];
    url[0]="http://www.acm.org/";

    string str;

    for(int i=1;i<150;i++)
        url[i]="";

    while(cin>>str)
    {
        string strTemp;
        if(str=="QUIT") break;

        if(str=="VISIT")
        {
            cin>>strTemp;
            point++;
            url[point]=strTemp;
            cout<<url[point]<<endl;
        }
        else if(str=="BACK")
        {
            if(point-1<0) cout<<"Ignored"<<endl;
            else
            {
                point--;
                cout<<url[point]<<endl;
            }
        }
        else if(str=="FORWARD")
        {
            if(url[point+1]=="") cout<<"Ignored"<<endl;
            else
            {
                point++;
                cout<<url[point]<<endl;
            }
        }



    }


    return 0;
}

告诉我wa


第二个程序加了个标志位count就ac...当时我就爆走了。。。
#include <iostream>
#include <string>

using namespace std;

int main()
{
    int point=0;
    int count=0;
    string url[150];
    url[0]="http://www.acm.org/";

    string str;

    while(cin>>str)
    {
        string strTemp;
        if(str=="QUIT") break;

        if(str=="VISIT")
        {
            cin>>strTemp;
            point++;
            count=point;
            url[point]=strTemp;
            cout<<url[point]<<endl;
        }
        else if(str=="BACK")
        {
            if(point-1<0) cout<<"Ignored"<<endl;
            else
            {
                point--;
                cout<<url[point]<<endl;
            }
        }
        else if(str=="FORWARD")
        {
            if(point+1>count) cout<<"Ignored"<<endl;
            else
            {
                point++;
                cout<<url[point]<<endl;
            }
        }



    }


    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