摘要: /* 输入一个整数n,输出该整数中重复的数字,如果没有重复出现的数字则输出no repeat number! */ #include<stdio.h> #include<math.h> #include<malloc.h> #include<string.h> #include<stdlib.h> 阅读全文
posted @ 2020-05-27 09:47 dreamy_java 阅读(879) 评论(0) 推荐(0) 编辑
摘要: /* 输入今天以前一个日期,算离今天的天数。 */ #include<stdio.h> #include<math.h> #include<malloc.h> #include<string.h> #include<stdlib.h> #include <time.h> main() { int y 阅读全文
posted @ 2020-05-27 08:43 dreamy_java 阅读(441) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h> #include<math.h> #include<malloc.h> #include<string.h> #include<stdlib.h> #include <time.h> main() { int a=1020,c=0; do{ a=a/2-2; c+ 阅读全文
posted @ 2020-05-26 10:26 dreamy_java 阅读(2821) 评论(0) 推荐(0) 编辑
摘要: 思路:就是将素数的数组置为0. 1、初始化a[n]-a[n]为1-n; 2、a[1]=0; 3、将a[1]-a[n]中为素数的置为0,即a[i]=0; 4、输出数组,将不为0的输出。 #include<stdio.h> #include<math.h> #include<malloc.h> #inc 阅读全文
posted @ 2020-05-24 22:00 dreamy_java 阅读(280) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h> #include<math.h> #include<malloc.h> #include<string.h> #include<stdlib.h> #include <time.h> /* 冒泡排序 */ void rankNum(int num[],int n) 阅读全文
posted @ 2020-05-24 16:28 dreamy_java 阅读(190) 评论(0) 推荐(0) 编辑
摘要: /* 计算字符串中子串出现的次数。 */ #include<stdio.h> #include<math.h> #include<malloc.h> #include<string.h> #include<stdlib.h> /* 10进制转8进制 */ int convertDecimalToOc 阅读全文
posted @ 2020-05-24 14:25 dreamy_java 阅读(436) 评论(0) 推荐(0) 编辑
摘要: /* 79. 单词搜索 给定一个二维网格和一个单词,找出该单词是否存在于网格中。 单词必须按照字母顺序,通过相邻的单元格内的字母构成,其中“相邻”单元格是那些水平相邻或垂直相邻的单元格。同一个单元格内的字母不允许被重复使用。 */ #include<stdio.h> #include<malloc. 阅读全文
posted @ 2020-05-07 11:24 dreamy_java 阅读(211) 评论(0) 推荐(0) 编辑
摘要: 求所有的子集,一下子就想到回溯,回溯有两个模板,一个是组合combition,一个是全排列oermutation。 /* 组合combination: n代表几个数,或者说树的深度。 path代表回溯过程中多叉树节点的值 depth代表path的下标 start开始位置。在组合中dfs是i+1,如果 阅读全文
posted @ 2020-05-01 20:58 dreamy_java 阅读(180) 评论(0) 推荐(0) 编辑
摘要: 1、景点表--sceneryid、景点名、等级lever-[a级、4a级]、内容content、highword、number、comment点评、景点介绍attractions2、热门景点排行表--柱状图+图片--sceneryrankid、name、lever、rank、number次数。3、景 阅读全文
posted @ 2020-04-28 22:40 dreamy_java 阅读(121) 评论(0) 推荐(0) 编辑
摘要: 方法一: 两遍扫描: 扫描第一遍,记录0、1、2的个数; 扫描第二遍,重填数组。 /* */ #include<stdio.h> #include<malloc.h> #include<string.h> #include<stdlib.h> #include<math.h> #include<st 阅读全文
posted @ 2020-04-22 08:52 dreamy_java 阅读(206) 评论(0) 推荐(0) 编辑