摘要:
typedef long long ll; ll mod_pow(ll x, ll n, ll mod) { ll res = 1; while (n>0) { if (n&1) res = res*x%mod; //如果二进制的最低位为1, 则乘上x^(2^i) x = x*x%mod; //将x 阅读全文
摘要:
int heap[MAX_N], sz = 0; void push(int x) { int i = sz++; while (i>0) { int p = (i-1)/2; i f(heap(p)<=x) break; heap[i] = heap[p]; i = p; } heap[i] = 阅读全文
摘要:
1.插入排序 void insert_sort(int a[], int n) { for (int i = 1; i < n; i++) { int temp = a[i], j = i-1; for (int j = i - 1; a[j]>temp&&j>=0; j--) a[j+1] = a 阅读全文