蓝桥杯算法提高VIP-特殊的质数肋骨-题解(Java代码) 摘要: 首先要明确,第一位数字要单独判断是否是质数,那么第一位数字肯定是2,3,5,7 其次,观察1——100的质数 防止宏中的运算符优先级出现问题的方法 **最好的方法就是把宏中的每一个参数都带上括号,这样可以最大程度的防止运算符优先级出现问题。**```c#include#include#defineS(a,b,c)(((a)+(b)+(c))/2)//每个参数都带上括号#defineAREA(S, 题解列表 2020年06月02日 0 点赞 0 评论 1131 浏览 评分:7.3
数据结构-Dijskra(迪杰斯特拉)最短路径算法-题解(C语言代码) 没有把矩阵里的0处理成无穷大,所以求最短路径和更新路径的时候有点繁琐。```c#include#include#definemax50intvisit[max];voidshortpathdij(intarcs[][max],intn,intv, 题解列表 2020年06月03日 0 点赞 0 评论 1144 浏览 评分:0.0
C语言考试练习题_保留字母-题解(C语言代码) 思路:定义字符数组,通过指针和标志i遍历数组的同时打印出字母,可以避免多开辟一个数组,浪费空间。```c#include#include#includevoidCalletter(char*ch);intmain(){charch[100];gets(ch);Calletter(ch);return0 题解列表 2020年06月03日 0 点赞 0 评论 1104 浏览 评分:9.9
数据结构-有序线性表的有序合并-题解(C++代码)(链表实现,详细注释,解释为什么结果错误50%) 摘要: > 结果错误50%是因为不能只输入一组数据,要通过while循环实现数据连续输入! #include using namespace std; typedef …… 题解列表 2020年06月03日 0 点赞 0 评论 1146 浏览 评分:9.9
数据结构-集合union-题解(C++代码)(线性表解法,简洁代码) #includeusingnamespacestd;typedefstructList{intL[200];intlength;}List;//定义线性表结构体voidshow(ListL)//输出函数{for(inti=0;iL1.L[i];}L1.length 题解列表 2020年06月03日 0 点赞 0 评论 1437 浏览 评分:9.9
[编程入门]猴子吃桃的问题-题解(C++代码) #include#includeusingnamespacestd;//递归算法,设第N天有X(N),N-1天有X(N-1),X(n-1)/2-1=X(N);递推式,然后将1~N逆向,所以X(1)=1就是第N天桃子数;X(N)就是第一天的桃子树;**intfunc1(intx){if(x==1){re 题解列表 2020年06月03日 0 点赞 0 评论 902 浏览 评分:0.0
C语言考试练习题_排列-题解(C++代码)最简单易懂的笨办法 摘要:#include "bits/stdc++.h" using namespace std; int main(){ int a[4]; cin>>a[0]>>a[1]>>a…… 题解列表 2020年06月03日 0 点赞 0 评论 810 浏览 评分:0.0
[编程入门]选择排序-题解(C语言代码) ```c/*首先在未排序序列中找到最小(大)元素,存放到排序序列的起始位置,再从剩余未排序元素中继续寻找最小(大)元素,然后放到已排序序列的末尾。以此类推,直到所有元素均排序完毕。*/``````c#include#defineN10intmain(intargc, 题解列表 2020年06月03日 0 点赞 0 评论 1068 浏览 评分:0.0
蓝桥杯2015年第六届真题-饮料换购-题解(C++代码) 摘要:```cpp #include using namespace std; int main() { int a; cin>>a; int sum=0; …… 题解列表 2020年06月03日 0 点赞 0 评论 1412 浏览 评分:9.9