合集-算法
摘要:排队接水 #include <bits/stdc++.h> #define CLOSE ios::sync_with_stdio(false);cin.tie(0);cout.tie(0) #define endl "\n" typedef long long LL; const int N = 1
阅读全文
摘要:#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10; int a[N]; // Fisher-Yates洗牌算法 void shuffle(int n) { srand(time(NULL)); for (int
阅读全文
摘要:string 在 C 语言中,提供了字符串的操作,但只能通过字符数组的方式来实现字符串。 而 string 则是一个简单的类,使用简单,在 OI 竞赛中被广泛使用。 相较于其他 STL 容器,string 的常数可以算是非常优秀的,基本与字符数组不相上下。 string常用操作 输出 string
阅读全文
摘要:队列 队列(queue)是一种具有「先进入队列的元素一定先出队列」性质的表。 由于该性质,队列通常也被称为先进先出(first in first out)表,简称 FIFO 表。 STL队列 以下操作的复杂度均为\(O(1)\)。 创建队列 queue<int> q queue<char> q
阅读全文