摘要:
head 表示单链表的头 cnt 表示 数组坐标 const int N = 1e6 +10; int e[N],ne[N]; //e[N]表示该数组节点存储的值的大小,ne[N]表示该数组节点后续节点的坐标 void init()/*初始化*/{ head = -1;// 后续节点为-1的表示这是 阅读全文
摘要:
upper_bound函数返回数组队列中第一个大于x的数组位置,要是想知道x的数组下标,需要减去数组a的地址 前提是数组已经排好序 int k = upper_bound(a,a+n,x)-a;//k表示a数组中第一个大于x的数值的数组下标 lower_bound函数返回数组中第一个大于等于x的数组 阅读全文
摘要:
#include<iostream>#include<algorithm>using namespace std; int n; //求a^k mod p 的结果long long pmi(int a,int k,int p){ long long res=1; while(k){ if(k&1) 阅读全文