- 博客(8)
- 问答 (1)
- 收藏
- 关注
原创 跳台阶问题
def splitnum(n,k,arr) if n==0 then puts arr.to_s end for i in k..2 arr.push(i) if n-i>= 0 then splitnum(n-i,k,arr) end arr.po
2016-06-20 10:58:27 174
原创 跳台阶问题:一个台阶共有N级,如果一次可以跳1级,也可跳2级,求总共有多少种跳法
def splitnum(n,k,arr) if n==0 then puts arr.to_s end for i in k..2 arr.push(i) if n-i>= 0 then splitnum(n-i,k,arr) end arr.po
2016-06-20 10:56:16 868
原创 全排列,我还是没想明白
#include void print(int arr[],int cnt) { int i; for (i=0;i printf("%d,",arr[i]); } printf("\n"); } void swap(int *a,int *b) { int temp; temp = *a; *a=*
2016-06-20 09:56:25 191
原创 最长部分和
#include void print(int a[],int cnt) { int i; for (i=0;i printf("%d,",a[i]); } printf("\n"); } void print2(int a[8][8],int cnt) { int i,j; for (i=0;i
2016-06-20 09:19:49 177
原创 和为定值
#include void main() { int num[100]={1,2,4,5,7,11,15}; int i,j; for(i=0;i for(j=0;j if (i != j && num[i]+num[j]==15) printf("%d+%d=%d",num[i],num[j],15);
2016-06-19 18:49:25 387
原创 冒泡法排序
#include void swap(int *a,int *b) { int temp; temp = *a; *a = *b; *b = temp; } void maopao(int b[],int num) { int i,j; for(i=0;i for(j=0;j prin
2016-06-19 18:39:12 238
原创 回文判断
#include #include void main(){ char str[100]="abcbad"; int begin=0; int end=strlen(str)-1; // int i; int shihuiwen=1; //1:是,0:否 while (begin printf("%c,%c",str
2016-06-19 17:47:00 156
原创 把字符串转为整数
#include #include int main() { char str[10]="12"; long num=0; int i; for(i=0;i printf("%c ",str[i]); num = (num*10 + str[i]-'0'); } printf("%ld"
2016-06-19 17:22:00 277
空空如也
图灵为什么用图灵机模型证明了判定性问题不可解
2015-08-08
TA创建的收藏夹 TA关注的收藏夹
TA关注的人