10 2020 档案
摘要:set,自动排序去重,没有二维set,只能用map #include <iostream> #include <set> using namespace std; int main() { set<int> s; int n;cin>>n; for(int i=0;i<n;i++) { int x;
        阅读全文
                
摘要:蓝桥杯:不同子串 #include <iostream> #include <string> #include <map> using namespace std; int main() { string str = "0100110001010001"; // str ="aaab"; map<s
        阅读全文
                
摘要:###1.数组模拟队列(hh=0,tt=-1模拟的是双端队列) int q[N] int hh=0,tt=-1;队头指针和队尾指针. push -> q[++tt]=x; pop -> hh++;//从队头弹出 pop -> tt--;//从队尾弹出 empty() -> cout<<((hh<=t
        阅读全文
                
摘要:###upper_bound和lower_bound用于在排好序的序列中利用二分查找的方法进行查找。 #####从小到大的数组中: lower_bound(begin,end,num):从数组的begin位置到end-1位置,二分查找大于等于num的第一个元素,返回一个迭代器(该元素的地址), 不存
        阅读全文
                
摘要:###错误的写法 int c[N];//c[i]表示i点属于第几个连通块 dfs(1)//主函数中 void dfs(int u) { if(u>n)return; if(st[u])dfs(u+1); if(!st[u]) { c[u]=cnt; st[u]=1; } for(int i=h[u]
        阅读全文
                

 
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号