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<math.h> int n,m,a[50][50]={0},b[51]={0}; void abc(int x,int y,int t){ if(y<n){ if(a[y][x]==1){ abc(x,y+1,t-1); abc(x+1,y+1,t-1); }else{ abc(x+1,y+2,t); } } else{ b[x]+=(int)pow(2,t); } } void printf_abc(void){ int i,sum=0; for(i=0;i<n+1;++i){ sum+=b[i]; } for(i=2;i<=b[m];++i){ if(b[m]%i==0&&sum%i==0){ b[m]/=i; sum/=i; --i; } } if(b[m]==0) printf("0/1"); else printf("%d/%d",b[m],sum); } int main(){ int i,j; char c; scanf("%d %d",&n,&m); fflush(stdin); for(i=0;i<n;i++){ for(j=0;j<=i;j++){ while((c=getchar())==' '||c=='\n'); if(c=='*'){ a[i][j]=1; } else{ a[i][j]=0; } } } abc(0,0,n); printf_abc(); return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator