poj 1850 Code
2011-03-25 14:20
351 查看
简单数学题
#include<iostream> #include<cstring> using namespace std; int C(int a,int b) { if(b==0) return 1; else return C(a-1,b-1)*a/b; } int main() { char s[15],str[15]; int len,i,ans=0,j; bool flag=true; scanf("%s",s); len=strlen(s); for(i=1;i<len;i++) if(s[i]<=s[i-1]) { flag=false; break; } if(flag) { strcpy(str+1,s); str[0]='a'-1; for(i=1;i<len;i++) ans+=C(26,i); for(i=1;i<=len;i++) for(j=str[i-1]-'a'+1;j<str[i]-'a';j++) ans+=C(26-j-1,len-i); ans++; } printf("%d/n",ans); return 0; }
相关文章推荐
- POJ 1850:Code 组合数学
- POJ 1496 Word Index || POJ 1850 Code
- poj1850~Code~(组合数的应用)
- POJ 1850 Code
- poj 1850 Code
- POJ 1850 Code
- POJ1850-Code
- POJ 1850 Code(组合数学)
- poj 1850 Code 组合数学
- poj1850 Code【组合数学】By cellur925
- poj 1850----Code
- poj 1850 Code
- POJ1850-Code
- POJ 1850 Code(组合数)
- POJ 1850 Code/POJ 1496 Word Index(组合数学-字母串序号)
- POJ1850 Code(组合+康托展开)
- POJ 1850-Code(组合数学)
- poj 组合数 1850 Code
- POJ 1850 Code
- POJ 1850 Code