上一页 1 ··· 3 4 5 6 7 8 下一页
摘要: 注意到累积里程类型用long long; #include <stdio.h> #include <math.h> #include <malloc.h> #include <string.h> #define KeyLength 18 typedef enum {false,true } bool 阅读全文
posted @ 2020-03-07 11:36 跃鱼 阅读(423) 评论(0) 推荐(0) 编辑
摘要: 解题思路:采用散列表(链表)存储账号密码的信息 #include <stdio.h> #include <math.h> #include <malloc.h> #include <string.h> typedef enum {false,true } bool; typedef struct L 阅读全文
posted @ 2020-03-07 10:27 跃鱼 阅读(483) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h> #include <math.h> #include <string.h> #include <malloc.h> typedef enum {false,true } bool; bool IsPrime(int n) { if(n==0||n==1) ret 阅读全文
posted @ 2020-03-06 21:14 跃鱼 阅读(1098) 评论(0) 推荐(0) 编辑
摘要: 注意:第i次冲突后第i次探测的散列地址 Hi=(H(key)+di)%p #include <stdio.h> #include <string.h> #include <math.h> #include <malloc.h> typedef struct { int key; char value 阅读全文
posted @ 2020-03-06 19:43 跃鱼 阅读(839) 评论(0) 推荐(0) 编辑
摘要: 解题思路: 1、初始化散列表,用于标记散列地址是否已用 2、构造结构体,(关键字去重)记录关键字的值和地址 3、读入数据,判断该关键字是否重复查询 4、用辅助数组记录每个关键字的地址,遍历输出 #include <stdio.h> #include <string.h> typedef struct 阅读全文
posted @ 2020-03-06 16:37 跃鱼 阅读(619) 评论(0) 推荐(0) 编辑
摘要: 解题思路: 用散列表(链表结构) 1、计算散列表长度(取比输入数据大一点的素数p) 2、构造散列函数 3、读入数据,求出散列位置插入 4、一边遍历散列表,一边求出现最多的电话狂人 #include <stdio.h> #include <malloc.h> #include <string.h> # 阅读全文
posted @ 2020-03-06 11:54 跃鱼 阅读(312) 评论(0) 推荐(0) 编辑
摘要: 输入样例1: 6 15 1 2 5 1 3 3 1 4 7 1 5 4 1 6 2 2 3 4 2 4 6 2 5 2 2 6 6 3 4 6 3 5 1 3 6 1 4 5 10 4 6 8 5 6 3 输出样例1: 12 输入样例2: 5 4 1 2 1 2 3 2 3 1 3 4 5 4 输出 阅读全文
posted @ 2020-03-05 23:11 跃鱼 阅读(407) 评论(0) 推荐(0) 编辑
摘要: 输入样例1: 5 88 70 61 96 120 输出样例1: 70 输入样例2: 7 88 70 61 96 120 90 65 输出样例2: 88解题思路:生成二叉排序树的同时调整为平衡二叉树需要调整的情况:1、左单旋 2、右单旋 3、先右旋后左旋 4、先左旋后右旋 #include <stdi 阅读全文
posted @ 2020-03-04 21:48 跃鱼 阅读(1569) 评论(0) 推荐(0) 编辑
摘要: //用连通分量dfs //环1:0->3->2->7->0 //交换a[0]=0<->a[1]=5 //环2:0->5->4->6->9->1->0 #include <stdio.h> int d[100001]= {0},a[100001]= {0}; void dfs(int x) { d[x 阅读全文
posted @ 2020-03-04 16:54 跃鱼 阅读(383) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h> #include <string.h> int n; int visit[11]; int re[11]; void dfs(int step) { int i; if(step==n+1) { for(i=1; i<=n; i++) { printf("%d" 阅读全文
posted @ 2020-03-04 16:52 跃鱼 阅读(460) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 下一页