题解列表

筛选

字符逆序cin.get(str,100);

摘要:#include#includeusing namespace std;int main(){    char str[100];    cin.get(str,100);//gets(str);  ……
优质题解

✔✔✔ 树的直径问题+DFS求解 [c++]

摘要:典型的**树的直径**问题:图中所有最短路径的最大值即为「直径」,可以用两次 DFS 或者树形 DP 的方法在 O(n) 时间求出树的直径。 题解以两遍DFS为例 **定理:**在一个连通无向无环……

字符串的输入输出处理

摘要:#include #include#includeusing namespace std; int main() {     int n;char str[1000];    cin>>n……

迭代法求平方根 题解

摘要:解题思路:先假设x1的值x1=a/2确定x2x2=(x1+a/x1)/2注意事项:输出要注意小数位注意for与while的区别参考代码:import java.util.Scanner;/* * 用迭……

1025: [编程入门]数组插入处理 题解

摘要:解题思路:枚举到第一个大于该数的数,插入即可注意事项:注意插入要倒叙参考代码:#include<stdio.h>int main(){   int x[10],i,c;   for(i=0;i<9;i……