| ||||||||||
| 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,郁闷~~请问哪位能指点迷津#include <iostream.h>
void main()
{
int n;
int high,low;//high为最高可取的值。low同理
char A[10];
int check;
while(1)
{
check = 1;
high = 10;
low = 1;
cin>>n;
if(n == 0) break;
cin>>A;
cin>>A;//保证A取第二位的首字母;若不为就跳过
if(A[0] == 'h' && n <= high) high = n - 1;
if(A[0] == 'l' && n >= low) low = n + 1;
if(A[0] != 'o')
while(1)
{
cin>>n>>A;
cin>>A;
if(A[0] == 'h' && n <= high) high = n - 1;
if(A[0] == 'l' && n >= low) low = n + 1;
if(high < low) check = 0;
if(A[0] == 'o') break;
}
if(low > high) check = 0;
if(check == 1) cout<<"Stan may be honest"<<endl;
else cout<<"Stan is dishonest"<<endl;
}
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator