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:new,,,,我用另外的思想写的,但是还是错了,靠In Reply To:new,,,,我用另外的思想写的,但是还是错了,靠 Posted by:drownever at 2006-12-23 00:59:29 #include<iostream.h> #include<stdio.h> #include<string.h> int main() { long temph=0,templ=0; int hight[1000]; //temph起到标指针作用。 int low[1000],temp,flag=1; //templ起到指针作用,temp 表示读取数据。 char s[20]; //flag,表示诚实与否。 cin>>temp; while(temp!=0) { gets(s); if(strcmp(s,"too hight")==0) { hight[temph++]=temp; } if(strcmp(s,"too low")==0) { low[templ++]=temp; } if(strcmp(s,"right on")==0) { int maxl=0,minh=11; for(int i=0;i<templ;i++) if(maxl<low[i]) maxl=low[i]; for(int j=0;j<temph;j++) if(minh>hight[j]) minh=hight[j]; if(temp<minh&&temp>maxl) cout<<"Stan may be honest"<<endl; else cout<<"Stan is dishonest"<<endl; temph=templ=0; //清空从新下轮判断。 flag=1; } cin>>temp; } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator