摘要: 牛顿迭代法主要解决的是方程近似求根问题,关于牛顿迭代法的详细推导和数学原理见此链接; https://www.matongxue.com/madocs/205.html https://oi-wiki.org/math/newton/ 接下来主要说一下怎么利用牛顿迭代法进行求根,其实就是利用这种迭代 阅读全文
posted @ 2020-02-26 18:37 暮云林凌 阅读(738) 评论(0) 推荐(0)
摘要: 老生常谈的问题,N年前仔细做过总结,现在全忘光了; 重载函数: 一定要参数列表不同,名字相同,C++编译器可以根据参数的类型自动调用; void exc(char& a, char& b) { char temp = a; b = a; b = temp; } void exc(int& a, in 阅读全文
posted @ 2020-02-26 18:00 暮云林凌 阅读(232) 评论(0) 推荐(0)
摘要: 主要针对于机试中的IO读写问题,c语言实现和使用太过于繁琐,所以以后遇到类似题目还是用C++的; 主要包含头文件 #include<iostream> #include<fstream> #include<sstream> 一般来说,用fstream就足够够用了,他包含了istream和ostrea 阅读全文
posted @ 2020-02-26 16:27 暮云林凌 阅读(882) 评论(0) 推荐(0)
摘要: 基本思想: 上三角判断,简单逻辑; 关键点: 无; #include<stdlib.h> #include<stdio.h> #define maxn 21 int n,num; int ma[maxn][maxn]; int charge(int n) { //判断是否是上三角 for (int 阅读全文
posted @ 2020-02-26 11:59 暮云林凌 阅读(962) 评论(0) 推荐(0)
摘要: 基本思想: 和三维矩阵的遍历类似,注意别超出数组大小; 关键点: 无; #include<stdlib.h> #include<stdio.h> #define maxn 21 int m,n; int index = 0; int ma[maxn][maxn]; int X[4] = { 0,1 阅读全文
posted @ 2020-02-26 11:51 暮云林凌 阅读(1142) 评论(0) 推荐(0)
摘要: 基本思想: 注意一下副对角线使i+j=n的规律; 关键点: 无; #include<stdlib.h> #include<stdio.h> #define maxn 11 int n; int ma[maxn][maxn]; int main(){ int a; scanf("%d",&n); in 阅读全文
posted @ 2020-02-26 11:00 暮云林凌 阅读(596) 评论(0) 推荐(0)
摘要: 基本思想: 弱智题; 关键点: 无; #include<stdlib.h> #include<stdio.h> int m, n; int main(){ int a; scanf("%d %d", &m, &n); for (int i = 0; i < m; i++) { int sum = 0 阅读全文
posted @ 2020-02-26 10:51 暮云林凌 阅读(542) 评论(0) 推荐(0)