皮皮灰灰辉
皮皮灰灰辉
全部文章
分类
题解(20)
归档
标签
去牛客网
登录
/
注册
皮皮灰灰辉的博客
全部文章
(共20篇)
题解 | #参数解析#
字符串切分,可以通过strtok实现 易出错的点:见代码注释 #include <stdio.h> #include <stdlib.h> #include <string.h> char res[100][1000]; int main() { int...
C
字符串
2022-03-23
0
226
题解 | #合法的括号字符串#
C语言本身没有bool,用int替换一下即可,然后两次遍历即可,下面代码还可以有很多优化,不要栈,直接计数即可 /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param s string字符串 * @return bool布尔型 ...
C
栈
2022-03-22
2
311
题解 | #合法IP#
简单的字符串切分,面向用例编程,判断的地方需要注意一点 #include<stdio.h> // 拆分字符串 int split(char in[50], char **sub) { char *p = in; char key[2] = "."; int num...
C
字符串
2022-03-21
0
219
题解 | #在字符串中找出连续最长的数字串#
没什么特殊的算法,不加注释了,一次遍历得结果,一次遍历输出就可以了 注意char转int型 #include <stdio.h> #include <stdlib.h> #include <string.h> int res[200][200] = {0}; ...
C
字符串
2022-03-21
0
298
题解 | #公共子串计算#
与“查找两个字符串a,b中的最长公共子串”题的解答一样,只是需要输出的是长度 #include <stdio.h> #include <stdlib.h> #include <string.h> char str1[301]; char str2[301]; c...
C
动态规划
2022-03-19
0
210
题解 | #Redraiment的走法#
最长子序列问题 #include <stdio.h> #include <stdlib.h> #include <string.h> int main() { int n; scanf("%d", &n); int arr[200...
动态规划
C
2022-03-19
1
220
题解 | #查找两个字符串a,b中的最长公共子串#
动态规划,类似的字符处理题有很多,可以结合起来一起做 注意的点是根据字符串长度分类讨论 #include <stdio.h> #include <stdlib.h> #include <string.h> char str1[301]; char str2[30...
C
动态规划
字符串
2022-03-18
0
250
题解 | #DNA序列#
滑动窗口,直接暴力遍历 #include <stdio.h> #include <stdlib.h> #include <string.h> int main() { char str[1005] = {0}; char res[1005] = ...
C
字符串
2022-03-18
0
232
题解 | #找出字符串中第一个只出现一次的字符#
牛客上c语言不方便使用hash表,便用数组存放次数,遍历两边字符串即可 #include <stdio.h> #include <stdlib.h> #include <string.h> int main() { char str[1005] = {0...
C
模拟
字符串匹配
2022-03-18
0
238
题解 | #高精度整数加法#
char与int的转化整体可以用atoi,局部的话可以自己转化一下 #include<stdio.h> #include<string.h> #include <stdlib.h> char str1[10001] = {0}; char str2[10001]...
C
数学
2022-03-18
0
224
首页
上一页
1
2
下一页
末页