题解列表

筛选

用快读scanf别用cin

摘要:解题思路:/*带权并查集模板*/注意事项:参考代码:#include<bits/stdc++.h>typedef long long ll;using namespace std;int fa[100……

判断数正负

摘要:解题思路:注意事项:参考代码:N = int(input())if N > 0:    print("positive")elif N == 0:    print("zero")elif N < 0……

vector写数组

摘要:#include<bits/stdc++.h> using namespace std; int main() {     int n;     cin>>n;     vector<in……

优先队列的使用

摘要:#include<bits/stdc++.h> using namespace std; priority_queue<int>v;//大根堆 int main() {     int n,……

2853: 字符替换 c++ (string)

摘要:解题思路:注意事项:参考代码:    #include <bits/stdc++.h>    using namespace std;    const int N = 1e3;    typedef……

c语言牛顿迭代法求平方根

摘要:# C语言迭代法求平方根 迭代法也称牛顿迭代法,核心公式是**牛顿迭代公式**: $$x\_{n+1}=x\_{n}-\frac{f(x\_{n})}{f^{\prime}(x\_{n})}$$ ……

字符统计两种方式(C语言)

摘要:方法区别:第一种:输出在自定义函数中第二种:输出在主函数中注意事项:使用scanf函数输入时,不能用 "%s" ,因为输入空格后输出只会显示空格之前的内容,所以要用 "%[^\n]" ,表示除了回车键……

自定义函数求解水仙花数(C语言)

摘要:解题思路:水仙花数是3位整数,所以判断区间是包含100~999之间注意事项:水仙花数是各个位数的三次方之和等于它本身参考代码:#include <stdio.h> #include <math.h>……

[编程入门]求和训练

摘要:解题思路:注意事项:参考代码:#include<stdio.h>#include<math.h>int main(void){ int a,b,c; double sum1=0,sum2=0,sum3……