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 |
水题!贴代码了……#include"stdio.h" #include"string.h" int main() { char a[100]; while(scanf("%s",&a)&&strcmp(a,"#")!=0) { float result=0.0; int i,j; int len; len=strlen(a); for(i=0;i<len;i++) { if(a[i]=='/') { if(i==0) result+=100; for(j=i-1;j>=0;j--) if(a[j]=='\\'||a[j]=='|') { break; } else if(a[j]=='.'||j==0) { result+=100; break; } } else if(a[i]=='\\') { if(i==len-1) result+=100; for(j=i+1;j<len;j++) if(a[j]=='/'||a[j]=='|') { break; } else if(a[j]=='.'||j==len-1) { result+=100; break; } } else if(a[i]=='|') { if(i==len-1) result+=50; for(j=i+1;j<len;j++) if(a[j]=='/'||a[j]=='|') { break; } else if(a[j]=='.'||j==len-1) { result+=50; break; } if(i==0) result+=50; for(j=i-1;j>=0;j--) if(a[j]=='\\'||a[j]=='|') { break; } else if(a[j]=='.'||j==0) { result+=50; break; } } else if(a[i]=='.') result+=100; } result/=len; printf("%d\n",(int)result); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator