| ||||||||||
| 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的没道理 手机交题不容易啊 浪费1个多小时宝贵的时间完全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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator