上一页 1 2 3 4 5 6 ··· 25 下一页
思路:定义全局变量数组保存,通过map映射。 #include <iostream> #include <string> #include <map> using namespace std; class MiniMemoryPool { private: int total[100] = {0}; Read More
posted @ 2022-02-15 21:57 A-inspire Views(45) Comments(0) Diggs(0) Edit
#include <iostream> #include <string> #include <vector> #include <numeric> using namespace std; // 待实现函数,在此函数中填入答题代码 int ClusterLatency(const vector<i Read More
posted @ 2022-02-11 20:56 A-inspire Views(268) Comments(0) Diggs(0) Edit
6.C/c++数字转字符串: string str = to_string(i); 7.查找字符/字符串 T.find(P,begin) != strting::npos; 代码: #include <iostream> using namespace std; class Solution { p Read More
posted @ 2022-02-11 20:08 A-inspire Views(62) Comments(0) Diggs(0) Edit
思路: 只要枚举最终匹配的子串是从s中的哪个字符开始的就好了,并记录最小值。 代码: #include <iostream> #include <string.h> using namespace std; int main() { // please define the C++ input he Read More
posted @ 2022-01-28 09:38 A-inspire Views(41) Comments(0) Diggs(0) Edit
思路: 采用双指针方法遍历字符串; 1)初始时左右边界指针都指向位置0; 2)边界判断:左元音右缺陷(right++)、左缺陷右元音(left++)、左右都缺陷(left++、right++)、左右都元音(计算缺陷度); 3)计算元音字串的长度: 1. 先判断当前缺陷度是否满足要求,小于则right Read More
posted @ 2022-01-28 09:25 A-inspire Views(1198) Comments(0) Diggs(0) Edit
1.当数组做为函数的形参的时候,该参数退化为指针,并且是无法直接求得数组的大小。传数组给一个函数,数组类型自动转换为指针类型,因而传的实际是地址 2.结构体数组复制并赋值 for(int i = 0;i <n;i++ ) memcpy_s(struct_target[i].arry,sizeof(s Read More
posted @ 2021-12-10 17:52 A-inspire Views(45) Comments(0) Diggs(0) Edit
解压zip文件 unzip -o -d /home/sunny myfile.zip unzip xxx.zip 解压tar.gz文件tar -zxvf ×××.tar.gz root 赋予账户文件夹下的权限: chmod -R 777 xxx/-R表示为下面的文件赋予权限 复制文件:cp -r d Read More
posted @ 2021-12-10 09:33 A-inspire Views(125) Comments(0) Diggs(0) Edit
题目描述 现在你面对一个n×m的矩阵,矩阵中的每一个元素都是一个整数,现在你需要计算从矩阵的左上角走到右下角所走过的所有元素相加的最大和。注意:只能向右或者向下走,不能走出边界。 解答要求时间限制:1000ms, 内存限制:100MB 输入 输入第一行包含两个用空格分开的整数n (1≤ n ≤ 10 Read More
posted @ 2021-10-27 20:08 A-inspire Views(225) Comments(0) Diggs(0) Edit
题目描述 给定一个整数n,输出1-n的全排列。 解答要求时间限制:1000ms, 内存限制:100MB 输入 每个测试文件只有一个数据,输入一个整数n(0<n≤8)。 输出 输出全排列(每个排列中的数字用空格隔开),且每组排列注意按字典序输出所有排列(即要先输出123才能输出132,而不能先输出13 Read More
posted @ 2021-10-27 19:22 A-inspire Views(107) Comments(0) Diggs(0) Edit
题目描述 给定一个十进制正整数,要求输出这个正整数的二进制数、八进制数和十六进制数。 解答要求时间限制:1000ms, 内存限制:100MB 输入 输入数据只有一行,包含一个十进制正整数x(1 <= x <= 1000000000) 输出 输出一共3行,第一行输出二进制数,第二行输出八进制数,第三行 Read More
posted @ 2021-10-27 18:07 A-inspire Views(100) Comments(0) Diggs(0) Edit
上一页 1 2 3 4 5 6 ··· 25 下一页