题解列表
1024: [编程入门]矩阵对角线求和
摘要:解题思路:输入矩阵,两个对角线的特征是1.x=y 2.x+y=2注意事项:参考代码:#include<stdio.h>int main(){ int x, y, s1 = 0, s2 = 0, ……
1025: [编程入门]数组插入处理 题解
摘要:解题思路:枚举到第一个大于该数的数,插入即可注意事项:注意插入要倒叙参考代码:#include<stdio.h>int main(){ int x[10],i,c; for(i=0;i<9;i……
蓝桥杯基础练习VIP-Huffuman树
摘要:解题思路:注意事项:参考代码:import java.awt.List;
import java.lang.reflect.Array;
import java.util.Arrays;
imp……
迭代法求平方根 题解
摘要:解题思路:先假设x1的值x1=a/2确定x2x2=(x1+a/x1)/2注意事项:输出要注意小数位注意for与while的区别参考代码:import java.util.Scanner;/* * 用迭……
蓝桥杯][算法提高VIP]我们的征途是星辰大海
摘要:解题思路:注意事项:每行指令都是从新回到原点再走的参考代码:#判断每走一步的结果
def check(x,y,lab):
if x>=len(lab) or x<0 or y>=len(l……
C************************************
摘要:#include <stdio.h>#include <stdlib.h>#include <string.h>int main(){ int a[1000],n,i,j,temp; scan……
字符串的输入输出处理
摘要:#include #include#includeusing namespace std;
int main()
{
int n;char str[1000];
cin>>n……
2074: [STL训练]A+B(Java)
摘要: import java.math.*;
import java.util.*;
public class Main {
public stat……
优质题解
✔✔✔ 树的直径问题+DFS求解 [c++]
摘要:典型的**树的直径**问题:图中所有最短路径的最大值即为「直径」,可以用两次 DFS 或者树形 DP 的方法在 O(n) 时间求出树的直径。
题解以两遍DFS为例
**定理:**在一个连通无向无环……