牛客305146746号
牛客305146746号
全部文章
题解
归档
标签
去牛客网
登录
/
注册
牛客305146746号的博客
全部文章
/ 题解
(共48篇)
题解 | #字符串通配符#
#include <stdio.h> #include <stdlib.h> #include <string.h> /* 判断字符是否是字母或数字 */ static int check_lon(char ch) { if(ch >= '0' &...
C
2022-06-22
0
250
题解 | #矩阵乘法计算量估算#
#include <stdio.h> /* 保存矩阵的行、列数 */ typedef struct { int x; //行数 int y; //列数 }CoordinateInfo_t; /* 思路: 例a为2*3的矩阵,b为3*2的矩阵,生成结果矩阵c为2*2的 a[x][y...
C
2022-06-22
0
205
题解 | #矩阵乘法#
#include <stdio.h> int main() { int x = 0, y = 0, z = 0; scanf("%d %d %d\n", &x, &y, &z); int A[x][y]; int B[y][z];...
C
2022-06-21
0
216
题解 | #24点游戏算法#
#include <stdio.h> int v[4] = {0}; static int dfs(int *array, int total) { if(total == 24) { return 1; } for(int i = 0...
C
2022-06-21
1
415
题解 | #配置文件恢复#
思路: 需要按照是否有空格来把命令区分为两类。 前一类仅有一个。 后一类按照空格所在的位置进行比较,注意需要判断比较符合的条件是否仅有一个,多个也应该视为unknown command(不知道) #include <stdio.h> static char *cmd1[6] = {...
C
2022-06-20
0
216
题解 | #查找两个字符串a,b中的最长公共子串#
#include <stdio.h> int main() { char str1[300] = {0}; char str2[300] = {0}; char out[300] = {0}; gets(str1); gets(str2); ...
C
2022-06-19
0
225
题解 | #MP3光标位置#
#include <stdio.h> /* 处理命令一共有四种情况 1、命令为向上,且歌曲数量>4 2、命令为向下,且歌曲数量>4 3、命令为向上,且歌曲数量<=4 4、命令为向下,且歌曲数量<=4 */ static int show(char c, int...
C
2022-06-19
0
201
题解 | #DNA序列#
思路: 先获取符合条件的最大数量,并用max记录下来 再用两个指针开始遍历,其中右指针为输入(遇到符合的条件就需要++)++,左指针为输出--。 每次循环后需要再次判断最大值并更新,并且用index记录更新后的开始地址。(用来判断GC-Ratio最高) 这样,即使后面有同样符合的条件,max和in...
C
2022-06-19
0
246
题解 | #找出字符串中第一个只出现一次的字符#
#include <stdio.h> int main() { char str[1000] = {0}; char c = '0'; gets(str); int len = strlen(str); int array[len]; m...
C
2022-06-19
0
204
题解 | #找出字符串中第一个只出现一次的字符#
#include <stdio.h> int main() { char str[1000] = {0}; char c = '0'; gets(str); int len = strlen(str); int array[len]; m...
C
2022-06-19
0
169
首页
上一页
1
2
3
4
5
下一页
末页