皮皮灰灰辉
皮皮灰灰辉
全部文章
分类
题解(20)
归档
标签
去牛客网
登录
/
注册
皮皮灰灰辉的博客
全部文章
(共20篇)
题解 | #从单向链表中删除指定值的节点#
简单的链表问题,本题解没有进行去除节点时的内存删除 typedef struct node { int var; struct node* next; }Node; #define NULL 0 int main() { int n,i; int a,b;//临时...
C
链表
2022-03-17
0
278
题解 | #称砝码#
动态规划,一个一个加 人为构造的map表需要开的很大才能不会越界 #include "stdio.h" #include "stdlib.h" #include "string.h" int WeightMap[1000000] = {0}; int Sum[100000] = {0}; int...
C
动态规划
2022-03-17
0
275
题解 | #求小球落地5次后所经历的路程和第5次反弹的高度#
直接算。 int main() { int n,i; scanf("%d", &n); double sum = n,tmp = n; for(i=1; i < 5; i++) { tmp = tmp/2; sum...
C
模拟
2022-03-16
0
216
题解 | #字符串加密#
简单的模拟,实现见如下代码 #include <stdio.h> #include <string.h> int main() { char in[101]; char key[101]; scanf("%s", key); scanf("...
C
模拟
2022-03-16
0
223
题解 | #密码截取#
Manacher算法 优化查找效率,以空间换时间 将原字符串转换成长度一定是奇数的字符串 #include<stdio.h> #include<string.h> #define min(a,b) (a > b ? b : a) #define max(a,b) (...
C
动态规划
2022-03-16
0
200
题解 | #字符串加解密#
比较简单的一一对应关系 #include<stdio.h> char encode(char a) { if(a == '9') { return '0'; } if(a >= '0' && a < '9') ...
C
2022-03-15
1
165
题解 | #密码验证合格程序#
初学者,直接暴力判断重复 #include<stdio.h> #include<string.h> int main(){ char str[1000]; int i,j; int len,flag;//flag是判断是否有重复 int a...
C
2022-03-14
0
196
题解 | #连续子数组的最大乘积#
此题难点在于负负得正,因此需要维护两个值 int main() { int n,i;//n为数组长度,i为循环变量 scanf("%d", &n); int* nums = (int *)malloc(sizeof(int)*n); for(i=0; i<...
C
动态规划
2022-03-11
0
362
题解 | #斐波那契数列#
#简单的递归 int main() { int n; scanf("%d", &n); int a=1,b=1,sum=0,i; if(n<=2) { printf("1"); return 0; } ...
C
动态规划
2022-03-11
0
191
题解 | #牛牛的双链表求和#
简单的输入输出,看代码即可 struct tree { int var; struct tree* next; }; #define NULL 0 int main() { int n,i; struct tree* head = (struct tree *)m...
C
双指针
数组
2022-03-10
0
258
首页
上一页
1
2
下一页
末页