上一页 1 2 3 4 5 6 7 8 ··· 15 下一页
摘要: #include<stdio.h> #include<malloc.h> #include<string.h> #include<stdlib.h> #include<math.h> #include<string.h> #include <iostream> typedef struct node 阅读全文
posted @ 2020-03-12 17:55 dreamy_java 阅读(1000) 评论(0) 推荐(0) 编辑
摘要: /* 给定一个字符串,请你找出其中不含有重复字符的 最长子串的长度。 解题思路:滑动窗口的左右边界是[i,j),窗口长度curlen,用k来遍历窗口的值是否和下一个待添加的数重复,若重复,则左窗口移到k+1的位置,并且更新maxlen和curlen */ #include<stdio.h> #inc 阅读全文
posted @ 2020-01-12 20:51 dreamy_java 阅读(1058) 评论(0) 推荐(0) 编辑
摘要: /* 计算字符串中子串出现的次数。 算法:字符串最长匹配原则,以下是图解: abcabcabc abc 循环遍历母串前lenT-lenP; 循环遍历字串,用j指向子串,用k记录每一趟母串开始的位置,若p[j]==t[k]则k、j均后移 若j==子串长度lenP,则找到一个子串,次数++。 */ #i 阅读全文
posted @ 2020-01-11 20:23 dreamy_java 阅读(2129) 评论(0) 推荐(0) 编辑
摘要: /* 判断一个素数能被几个9组成的数整除? */ #include<stdio.h> #include<math.h> #include<malloc.h> #include<string.h> main() { int n=9,i,ss; scanf("%d",&ss); for(i=1;;i++ 阅读全文
posted @ 2020-01-11 16:55 dreamy_java 阅读(412) 评论(0) 推荐(0) 编辑
摘要: /* 求0—7有8个,所能组成的奇数个数。首位范围1-7共7个,末位共4个。 解题思路: 当只有一位时,奇数个数为4; 当该数为两位数时,奇数个数为7*4; 当该数为三位数时,奇数个数为7*8*4; ...... 当该数为8位时,奇数个数为7*8*8*8*8*8*4; */ #include<std 阅读全文
posted @ 2020-01-11 16:44 dreamy_java 阅读(1191) 评论(0) 推荐(0) 编辑
摘要: /* 海滩上有一堆桃子,五只猴子来分。第一只猴子把这堆桃子平均分为五份,多了一个,这只 猴子把多的一个扔入海中,拿走了一份。 第二只猴子把剩下的桃子又平均分成五份,又多了 一个,它同样把多的一个扔入海中,拿走了一份, 第三、第四、第五只猴子都是这样做的, 问海滩上原来最少有多少个桃子? 解题思路: 阅读全文
posted @ 2020-01-11 16:21 dreamy_java 阅读(1596) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h> #include<math.h> #include<malloc.h> #include<string.h> #include<stdlib.h> #include <time.h> main() { char *s[]={"man","woman","girl" 阅读全文
posted @ 2020-01-11 15:32 dreamy_java 阅读(279) 评论(0) 推荐(0) 编辑
摘要: /* 练习指针函数:编写一个函数,输入n为偶数时,调用fa函数,当输入n为奇数时,调用fb函数(利用指针函数)。 */ #include<stdio.h> #include<math.h> #include<malloc.h> #include<string.h> #define N 8 int f 阅读全文
posted @ 2020-01-11 14:59 dreamy_java 阅读(350) 评论(0) 推荐(0) 编辑
摘要: /* 输入一个整数,并将其反转后输出。 */ #include<stdio.h> #include<math.h> #include<malloc.h> #include<string.h> #define N 8 main() { int n; scanf("%d",&n); while(n){ 阅读全文
posted @ 2020-01-11 14:51 dreamy_java 阅读(1051) 评论(0) 推荐(0) 编辑
摘要: /* 有n个人围成一圈,顺序排号。从第一个人开始报数(从1到3报数),凡报到3的人退出圈子,问最后留下的是原来第几号的那位。 解题思路: 1、设数组a[n],初始化数组a; 2、将数组a中的数循环赋值,赋值前需判断该位是否为0; 如何找到应该剔除的数?若n为4,则前一位是应该剔除的数,将其置为0,n 阅读全文
posted @ 2020-01-11 14:48 dreamy_java 阅读(1014) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 ··· 15 下一页