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 |
刚ac的。这样比直接记位置稍微麻烦一点,思路都比较清楚。特别注意:是may be,而不是一定honest,体会一下#include<iostream> //#include<stdio.h> #include<cstring> using namespace std; int main() { int record[12]={0}; char input[2][6]={0}; int n,i; cin>>n; while(1) { if(n==0) break; cin>>input[0]>>input[1]; if(strcmp(input[1],"high")==0) { for(i=n;i<=10;i++) record[i]=1; } else if(strcmp(input[1],"low")==0) { for(i=1;i<=n;i++) record[i]=1; } else if(strcmp(input[1],"on")==0) { if(record[n]==0 ) cout<<"Stan may be honest"<<endl; else cout<<"Stan is dishonest"<<endl; for(int j=1;j<=10;j++) record[j]=0; } else continue; cin>>n; } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator