上一页 1 ··· 18 19 20 21 22 23 24 25 26 ··· 32 下一页
摘要: 老生常谈的问题,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)
摘要: 基本思想: 平年365 2月28 不能被4整除; 闰年 366 2月29 能被4整除; 比如2020年,366天,二月二十九天; 关键点: 无; #include<stdlib.h> #include<stdio.h> #include<iostream> using namespace std; 阅读全文
posted @ 2020-02-25 12:33 暮云林凌 阅读(271) 评论(0) 推荐(0)
摘要: 基本思想: 直接计算,和7-3思想差不多; 关键点: 才发现自己侥幸逃脱的一个坑点:这题隐含了一个高阶阶乘的问题,如果贸然使用int来计算阶乘,会出现溢出问题; 后续总结一下; #include<stdlib.h> #include<stdio.h> #include<iostream> using 阅读全文
posted @ 2020-02-25 11:53 暮云林凌 阅读(338) 评论(0) 推荐(0)
摘要: 基本思想: 仍然是按照展开式的计算问题; 关键点: 无; #include<stdlib.h> #include<stdio.h> #include<iostream> using namespace std; double factor(double x) { if (x == 1.0) retu 阅读全文
posted @ 2020-02-25 11:29 暮云林凌 阅读(836) 评论(0) 推荐(0)
摘要: 基本思想: 按照公式逐项求和,最后对比给出的误差范围,确定求到第几步,是机试的一个典型题目; 关键点: 卡在了怎么输入指数浮点数的问题上,第一次件scanf("%le")中的le规格; 使用cin>>或者scanf("%le")其实都是可以输入1E-5作为浮点存储; 但是当时看内存踩坑里了,误以为1 阅读全文
posted @ 2020-02-25 11:21 暮云林凌 阅读(410) 评论(0) 推荐(0)
上一页 1 ··· 18 19 20 21 22 23 24 25 26 ··· 32 下一页