摘要:
思路要点: 对于第i - 1个和第i个数字,利用第i-1个数字乘以的2x,在此基础之上再进行多乘或者少乘使得第i个数字足以大于等于第i-1个数字,由此可以得到最小的步骤数(本质上也就是前缀和) #include <iostream> #define int long long using names 阅读全文
摘要:
BFS #include <iostream> #include <cstring> #include <queue> using namespace std; const int N = 1e5 + 10; int n, m, h[N], e[N], idx, ne[N], d[N]; queue 阅读全文
摘要:
#include <iostream> using namespace std; const int N = 1e6 + 10; int a[N], n; void quick_sort(int a[], int l, int r) { if (l >= r) return; int x = a[l 阅读全文
摘要:
先递归为多个小部分再进行排序 #include <iostream> using namespace std; const int N = 1e5 + 10; int a[N], tem[N]; void merge_sort(int a[], int l, int r) { if (l >= r) 阅读全文