摘要: ![image](https://img2024.cnblogs.com/blog/3655216/202507/3655216-20250716191419041-2136421197.png) ![image](https://img2024.cnblogs.com/blog/3655216/202507/3655216-20250716191437770-1632367275.png) 阅读全文
posted @ 2025-07-16 19:14 Lè_Sage 阅读(10) 评论(0) 推荐(0)
摘要: 思路: 1.计算积木的总数,除以堆数,得到平均每一堆数目; 2.对于超过平均值的积木,计算当前的积木数量和平均值的差值,把多的积木数量移到缺少的部分,直到积木高度相同。 代码: 点击查看代码 #include<iostream> #include<vector> using std::cin; us 阅读全文
posted @ 2025-07-16 15:50 Lè_Sage 阅读(27) 评论(0) 推荐(0)
摘要: 点击查看代码 #include<stdio.h> int main(int argc,const char *argv[]){ int m,n; int sum = 0; scanf("%d %d",&m,&n); for(int i = 1;i <= m;i++){ for(int j = 1;j 阅读全文
posted @ 2025-07-15 21:00 Lè_Sage 阅读(31) 评论(0) 推荐(0)
摘要: 点击查看代码 #include<stdio.h> #include<math.h> int main(int argc,const char *argv[]){ int n,square; scanf("%d",&n); square = (int)pow(n,2);//计算n的平方,pow的返回值 阅读全文
posted @ 2025-07-15 12:53 Lè_Sage 阅读(35) 评论(0) 推荐(0)
摘要: 点击查看代码 #include<stdio.h> #include<stdlib.h> int main(){ int n; scanf("%d",&n); int *arr = (int *)calloc(n,sizeof(int)); if(NULL == arr){ perror("callo 阅读全文
posted @ 2025-07-15 12:42 Lè_Sage 阅读(27) 评论(0) 推荐(0)
摘要: 点击查看代码 #include<stdio.h> #include<stdlib.h> int main(int argc,const char *argv[]){ int n,m; scanf("%d %d/n",&n,&m); int *arr = (int *)calloc(n,sizeof( 阅读全文
posted @ 2025-07-14 21:28 Lè_Sage 阅读(47) 评论(0) 推荐(0)
摘要: 点击查看代码 #include<stdio.h> int main(){ int a,b,c;//定义除数a被除数B余数C scanf("%d %d",&a,&b); c = a%b; while(c){ a = b;//辗转相除法当余数C等于零时被除数B即为最大公约数 b = c; c =a%b; 阅读全文
posted @ 2025-07-14 21:01 Lè_Sage 阅读(22) 评论(0) 推荐(0)
摘要: 数组的长度是固定的,但是我们往往并不知道一组数据的大小,这个时候再使用数组就会显得很麻烦,而vector (被称为容器),做为C++ 标准库中的一个容器类,表示对象的集合,它可以动态地存储一组元素,所以你可以根据需要轻松地调整 vector 的大小。和输入输出类似,如果想要使用vector, 必须包 阅读全文
posted @ 2025-07-14 19:22 Lè_Sage 阅读(45) 评论(0) 推荐(0)
摘要: 点击查看代码 //关于动态数组的建立,在C语言中,常常借助malloc、calloc创建动态数组 #include<stdio.h> #include<stdlib.h> int main(){ int n; printf("Please input the size of arr:"); scan 阅读全文
posted @ 2025-07-14 18:37 Lè_Sage 阅读(14) 评论(0) 推荐(0)
摘要: 1.Linux启动过程 2.gcc编译器把源文件编译为可执行文件过程: C语言程序编译过程:源程序 预处理 编译 汇编 链接 可执行文件 1.预处理: 对源码进行简单的加工,GCC编译器会调用预处理器cpp对程序进行预处理,其实就是解释源程序中所有的预处理指令,如#include(文件包含)、#de 阅读全文
posted @ 2025-07-12 20:50 Lè_Sage 阅读(10) 评论(0) 推荐(0)