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 |
Re:请大牛帮我看一看错在哪里!总是Wa,附上代码!In Reply To:请大牛帮我看一看错在哪里!总是Wa,附上代码! Posted by:wgg at 2008-08-04 17:32:48 > #include <iostream> > using namespace std; > #include <string> > int a[15],b[15]; > string str,str1="high",str2="low",str3="on"; > > int main () > { > int i,j,count=1; > int flag=1; > int s=1,t=1; > while(1) > { > count=1;flag=1; > cin>>a[0]; > if(a[0]==0) break; > cin>>str; cin>>str; > if(str==str1) b[0]=1; > if(str==str2) b[0]=-1; > if(str==str3) {cout<<"Stan may be honest"<<endl;continue;} > > for(i=1;;i++) > { > cin>>a[i]; count++; > cin>>str; cin>>str; > if(str==str1) b[i]=1; > if(str==str2) b[i]=-1; > > if(str==str3){ > b[i]=0; > for(j=0;j<count-1;j++) > { > s=a[j]-a[count-1];t=b[j]-b[count-1]; > if(s*t<=0) flag=0; > > } > > if(flag) cout<<"Stan may be honest"<<endl; > if(!flag) cout<<"Stan is dishonest"<<endl; > > break; > } > } > > } > return 0; > } > > 是不是有非法字符存在哦! 连续两次输入str Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator