摘要: nmcli n on//然后重启 阅读全文
posted @ 2024-06-02 21:07 Uiney 阅读(1) 评论(0) 推荐(0) 编辑
摘要: 问题原因:switch中case里面的局部变量出错 解决方法:将case里面定义的局部变量在switch外面定义。 //报错情况 switch (fork()) { case -1: error(1, errno, "fork"); case 0: // 子进程执行命令 if (execvp(arg 阅读全文
posted @ 2024-05-25 10:36 Uiney 阅读(22) 评论(0) 推荐(0) 编辑
摘要: sudo apt install nettools sudo apt update sudo apt install net-tools sudo apt install ssh sudo apt install gcc g++ gdb vim git //顺带安装编译器 阅读全文
posted @ 2024-05-24 20:49 Uiney 阅读(3) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h> #include<stdlib.h> typedef int E; typedef struct node { E val; struct node* next; }ListNode; ListNode* list_creat() { ListNode* list 阅读全文
posted @ 2024-05-10 23:03 Uiney 阅读(5) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h> #include <stdlib.h> #include<stdbool.h> typedef int E; typedef struct node { E data; struct node* next; } Node; typedef struct { Nod 阅读全文
posted @ 2024-05-03 20:42 Uiney 阅读(2) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h> #include <stdlib.h> #define PREALLOC_MAX 1024 #define DEFAULT_CAPACITY 8 typedef int E; typedef struct { E* elements; // 指向堆空间的数组 in 阅读全文
posted @ 2024-05-02 20:54 Uiney 阅读(2) 评论(0) 推荐(0) 编辑
摘要: 逻辑运算符包含: &&, ||, ! 。但是逻辑运算符不要求它操作数的值也为 0 或者 1, C 语言会把任何零值当作 false,任何非零值当作 true。 其中需要特别注意的是, && 和 || 会对操作数进行 "短路" 计算。也就是说,这些操 作符会首先计算左操作数的值,然后计算右操作数;如果 阅读全文
posted @ 2024-04-28 19:59 Uiney 阅读(6) 评论(0) 推荐(0) 编辑
摘要: 输入某两天的年月日,输出这两天的相距多少天。 解:计算两个日期到后一个日期最后一天的天数,相减即可。 1 #include<stdio.h> 2 3 #define LEAPYEAR 366 //闰年 4 #define COMMONYEAR 365 //平年 6 7 int month_day[1 阅读全文
posted @ 2024-04-24 16:53 Uiney 阅读(13) 评论(0) 推荐(0) 编辑
摘要: 1 left(str,length) #从左边开始截取str,length是截取的长度 2 3 right(str,length) #从右边开始截取str,length是截取的长度 4 5 substring(str,substr,m) #返回字符substr在str中第n次出现位置之前的字符串 6 阅读全文
posted @ 2023-03-11 14:45 Uiney 阅读(66) 评论(0) 推荐(0) 编辑
摘要: 题意:Kefa想去餐厅,要穿过公园。公园由一棵树组成,有n个节点,叶子节点上是餐厅,每节点上可能有猫,Kefa害怕猫,当有连续m只猫出现时,就不能继续往下走了。我们需要找出Kefa能去多少家餐厅。 题解:dfs深搜,设置跳出条件:连续猫得数量超过m;或者已经走到了叶子节点(度为0的节点)。搜索所在点 阅读全文
posted @ 2021-08-12 13:53 Uiney 阅读(82) 评论(0) 推荐(0) 编辑