题解列表

筛选

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

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

素数筛选法(埃拉托斯特尼方法)的代码实现

首先,我们应当先复习一下原始的筛选法原理,先圈出2,并且划掉列表中2的倍数(即其他偶数),然后回到开始,圈出第一个没有被画掉的数,画掉剩下数表中他的所有倍数。重复这一过程足够多次数,剩下的没有被画掉的就是我们要寻找的素数。并且,不难推出,我们要在所圈到的不小于sqrt(n)的最大整数之前就要停止筛选,

编写题解 2776: A*B问题

摘要:解题思路:注意事项:参考代码:#include<iostream>using namespace std;int main(){    int a,b;    while(cin>>a>>b)cout……

编写题解 1267: A+B Problem

摘要:解题思路:注意事项:参考代码:#include<iostream>using namespace std;int main(){    int a,b;    while(cin>>a>>b)cout……

编写题解 2749: Hello, World!

摘要:解题思路:注意事项:参考代码:#include <iostream>using namespace std;int main(){    cout << "Hello world!" << endl;……

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

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

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

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

编写题解 2853: 字符替换

摘要:解题思路:注意事项:参考代码:#include <bits/stdc++.h>using namespace std;typedef long long ll;int main(){   string……