随笔分类 -  基础算法刷题记录

上一页 1 ··· 3 4 5 6 7
摘要:基本思想: PAT一道同思想的题; 关键点: 无; #include<iostream> #include<vector> #include<algorithm> #include<string> #include<cmath> #include<set> #include<map> using n 阅读全文
posted @ 2020-03-01 11:24 暮云林凌 阅读(138) 评论(0) 推荐(0)
摘要:基本思想: 提前打表,直接算; 关键点: 无; #include<iostream> #include<vector> #include<algorithm> #include<string> #include<cmath> #include<set> #include<map> using nam 阅读全文
posted @ 2020-02-29 22:15 暮云林凌 阅读(221) 评论(0) 推荐(0)
摘要:基本思想: 无; 关键点: 无; #include<iostream> #include<vector> #include<algorithm> #include<string> #include<cmath> #include<set> using namespace std; int main( 阅读全文
posted @ 2020-02-29 21:50 暮云林凌 阅读(137) 评论(0) 推荐(0)
摘要:基本思想: 想到贪心,但是觉得时间复杂度太高,结果一不小心写出来个更复杂的贪心; 关键点: 注意特殊用例,有可能无法遍历出正确结果,即没有切换得到正确的值,此时要避免进入死循环; #include<iostream> #include<vector> #include<algorithm> #inc 阅读全文
posted @ 2020-02-29 21:47 暮云林凌 阅读(153) 评论(0) 推荐(0)
摘要:https://www.nowcoder.com/practice/04c8a5ea209d41798d23b59f053fa4d6?tpId=40&tqId=21334&tPage=1&rp=1&ru=/ta/kaoyan&qru=/ta/kaoyan/question-ranking 基本思想: 阅读全文
posted @ 2020-02-29 20:49 暮云林凌 阅读(176) 评论(0) 推荐(0)
摘要:https://www.nowcoder.com/practice/0383714a1bb749499050d2e0610418b1?tpId=40&tqId=21333&tPage=1&rp=1&ru=/ta/kaoyan&qru=/ta/kaoyan/question-ranking 基本思想: 阅读全文
posted @ 2020-02-29 20:31 暮云林凌 阅读(353) 评论(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 暮云林凌 阅读(1144) 评论(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 暮云林凌 阅读(272) 评论(0) 推荐(0)
摘要:基本思想: 直接计算,和7-3思想差不多; 关键点: 才发现自己侥幸逃脱的一个坑点:这题隐含了一个高阶阶乘的问题,如果贸然使用int来计算阶乘,会出现溢出问题; 后续总结一下; #include<stdlib.h> #include<stdio.h> #include<iostream> using 阅读全文
posted @ 2020-02-25 11:53 暮云林凌 阅读(340) 评论(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 暮云林凌 阅读(413) 评论(0) 推荐(0)

上一页 1 ··· 3 4 5 6 7