一、类模板说明 std::function是一个函数包装器模板,最早来自boost库,对应其boost::function函数包装器。在c++0x11中,将boost::function纳入标准库中。该函数包装器模板能包装任何类型的可调用元素(callable element),例如普通函数和函数对 ...
分类:
其他好文 时间:
2020-10-18 09:56:03
阅读次数:
18
约翰和贝西在叠积木。共有30000块积木,编号为1到30000。一开始,这些积木放在地上,自然地分成N堆。贝西接受约翰的指示,把一些积木叠在另一些积木的上面。一旦两块积木相叠, 彼此就再也不会分开了,所以最后叠在一起的积木会越来越高。约翰让贝西依次执行P条操作,操作分为两种: 第一种是移动操作,格式 ...
分类:
其他好文 时间:
2020-10-18 09:34:41
阅读次数:
15
#include <Windows.h> #include <iostream> #include <tchar.h> #ifdef UNICODE #define Cout std::wcout #else #define Cout std::cout #endif // UNICODE usin ...
为什么需要nullptr? NULL有什么毛病? 我们通过下面一个小小的例子来发现NULL的一点问题: class Test { public: void TestWork(int index) { std::cout << "TestWork 1" << std::endl; } void Tes ...
分类:
编程语言 时间:
2020-10-10 16:51:49
阅读次数:
30
#include <iostream> #include <string> using namespace std; class Student { public: Student() { cout << "默认构造函数" << endl; }; Student(int a, int s) { co ...
分类:
编程语言 时间:
2020-10-09 20:23:02
阅读次数:
20
#include<iostream> using namespace std; int main(){ string s; cin >> s; cout << "Hex: 0x" << s << endl; int dec = 0, oct = 0; for(int i = 0; i < s.siz ...
分类:
其他好文 时间:
2020-09-18 03:14:58
阅读次数:
39
算符优先文法的应用 #include<iostream> using namespace std; const int N = 110; char sb[N], pp = -1; int dg[N], qq = -1; int cmp(char a, char b){ if(a == '(') re ...
分类:
其他好文 时间:
2020-09-18 02:55:39
阅读次数:
31
Div3,享受俯冲的快感 A: 给两个整数$a$和$b$,你可以让$a \pm k (k \in [1, 10]) $,求最少操作次数。 签到题,直接给Code吧: /* ID: Loxilante Time: 2020/09/04 Prog: CF1409A Lang: cpp */ #ifdef ...
分类:
其他好文 时间:
2020-09-17 16:39:43
阅读次数:
24
Miku 对于线段树来讲,lazy的更新是一个要仔细考虑的问题 #include<iostream> #include<cstdio> #include<cstring> #include<cstring> using namespace std; int n,m; int sum[1200005] ...
分类:
其他好文 时间:
2020-09-17 16:39:27
阅读次数:
26
20行写完极其害怕 只能跑1e5的数据,那个1e6强制在线的开o2只有20pts QAQ 不用reserve也可以过,不过开了之后200ms的点只要130-140ms #include<bits/stdc++.h> using namespace std; #define ll long long ...
分类:
其他好文 时间:
2020-09-17 12:26:24
阅读次数:
24