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好几天(附源代码)各位大牛帮忙看看~~#include<stdio.h> #include<string.h> int main() { int n,i=0,j=0,t=0,flag=0;//t用来存储right on的数据,flag用作判断输出 int h[10]={0},l[10]={0}; //h[10],l[10]分别用来存储too high和too low的数据 char s[30]={0}; while(scanf("%d",&n) != EOF && n!=0 ){ getchar(); gets(s); if( !(strcmp(s,"too high")) ){ h[i++]=n; } if( !(strcmp(s,"too low")) ){ l[j++]=n; } if( !(strcmp(s,"right on")) ){ t = n; while(i){ i--; if(t>=h[i]){flag = 1;} } while(j){ j--; if(t<=l[j]){flag = 1;} } if(flag==1) { printf("Stan is dishonest\n");flag=0;} else{ printf("Stan may be honest\n"); } } } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator