2022年4月23日
摘要: #include<cstdio> #include<cstring> int main() { int a[10]; memset(a, 0, sizeof(a)); for(int i = 0; i < 5; i++) scanf(" %d", &a[i]); for(int i = 0; i < 阅读全文
posted @ 2022-04-23 11:08 我欲 阅读(70) 评论(0) 推荐(0)
摘要: 伪代码(算法导论(原书第3版)P95): QUICKSORT(A, p, r) //A为数组,若需排序数组A全部元素,即QUICKSORT(A, 1, A.length) 1 if p < r 2 q = PARTITION(A, p, r) 3 QUICKSORT(A, p, q-1) 4 QUI 阅读全文
posted @ 2022-04-23 10:47 我欲 阅读(78) 评论(0) 推荐(0)
  2022年4月9日
摘要: BFS(广度优先算法)求迷宫最短路径, 可以联想《三体》中ETO为了杀死罗辑的“基因导弹”。 类似“感染”,上下左右的“感染”,“感染”了后再“感染”这个“感染体”的上下左右,直至找到“目标”,或找遍整个数组找不到目标就返回未找到。 此视频很清晰的展示:https://www.bilibili.co 阅读全文
posted @ 2022-04-09 23:41 我欲 阅读(85) 评论(0) 推荐(0)
  2022年3月28日
摘要: #include<iostream> #include<algorithm> #include<cstring> #define maxn 105 using namespace std; int w[maxn]; //物品所占 int v[maxn]; //物品价值 int dp[maxn][ma 阅读全文
posted @ 2022-03-28 20:30 我欲 阅读(26) 评论(0) 推荐(0)
  2022年3月19日
摘要: 二次更改,sort()优于qsort(),好像为qsort()优化版本,建议使用sort()。 sort()是#include<algorithm>中的STL。 void sort(_RandomAccessIterator __first, _RandomAccessIterator __last 阅读全文
posted @ 2022-03-19 11:51 我欲 阅读(267) 评论(0) 推荐(0)
  2022年1月10日
摘要: string中数字字符转int整型与int整型增入string型中(纯运用) 方法列前: string型转int型: string s("123"); int a = s[0] - '0'; int型增入string型中: int a; string s; s.push_back('0' + a); 阅读全文
posted @ 2022-01-10 23:14 我欲 阅读(407) 评论(0) 推荐(0)