int digui(int x) { if ( x == 1 ) return 1; else return x * digui(x-1); }
int main(){ int digui(int,int,int); int i,j,n,max,t; float value; scanf("%d%d",&n,&max); for(i=0;i<n;i++) scanf("%d",m+i); for(i=0;i<n;i++){ for(j=0;j<n-1;j++){ if(m[j]<m[j+1]){ t=m[j];m[j]=m[j+1];m[j+1]=t; } } } // for(i=0;i<n;i++) printf("m[%d]=%d ",i,m[i]); for(i=1;i<max+1;i++) { if(digui(0,i,n)) { if (min>100) { min=100; } si+=1/min;/*printf(" min=%f \n",min);*/ } } // printf(" si=%f",si); value=1/log(n+1)*log(2)/log(max+1.71828)*si; printf("%.4f",value); getchar();getchar(); }
int main() { int times; printf("Please input how many number you want to print:"); scanf("%d",×); digui(times); return 0; }
int main() { int times; printf("Please input number you want to calculate n!:"); scanf("%d",×); printf("%d! = %d",times,digui(times)); return 0; }
int digui(n) { if(n < MAX && been[n] != 0 ) { return been[n] ; } if(n <= 1) { been[n] = 1; return been[n]; } int ans = 0; n--; for(int i = 0;i <= n ;i++) { ans += digui(i) * digui(n - i); } if((n+ 1) < MAX ){ been[n + 1] = ans; } return ans; }
int digui(int n) { if (n > -1) { printf("%d",n); digui(n-1); printf("%d",n); } return 0; }
int numTrees(int n) { for(int i = 0,end = min(n,MAX); i < end;i++) { been[i] = 0; } return digui(n); /* printf("%d\n", digui(2)); printf("%d\n", digui(3)); printf("%d\n", digui(4)); return 0; */ }
int digui(int step,int sum,int n){ // printf("step=%d sum=%d n=%d",step,sum,n); int i,t=0; for(i=0;i<n;i++){ t=0; if (sum==m[i]) {min=step+1;/*printf(" ||min=%f ",min); */return 1;} if (sum>m[i]) t=digui(step+1,sum-m[i],n); if(t) return 1; } return 0; }
int main() { return digui(5); }
int digui(int n) { if (n == 1)return 1; return n = n * digui(n-1); }