发布于  更新于 

贴几个VSCode的常用代码片段

vscode OI

包括常用头文件,快读等.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
{
"Common Headers": {
"prefix": "#inc",
"scope": "cpp",
"body": [
"#include <iostream>",
"#include <algorithm>",
"#include <cstdio>",
"#include <cstring>",
"#include <fstream>",
"#include <cassert>",
"using namespace std;",
"",
"typedef long long int64;",
"",
"const int INF = 0x3f3f3f3f;",
"const int MAXN = $1;",
"",
"int main(){",
"\t//ifstream cin(\"$2.in\");",
"\t//ofstream cout(\"$2.out\");",
"\t$0",
"\treturn 0;",
"}"
]
},
"Fast Read":{
"scope": "cpp",
"prefix": "fastread",
"body": [
"#include <cctype>",
"#include <cstdio>",
"",
"inline int read()",
"{",
"\tint X = 0, w = 0;",
"\tchar ch = 0;",
"\twhile (!isdigit(ch))",
"\t{",
"\t\tw |= ch == '-';",
"\t\tch = getchar();",
"\t}",
"\twhile (isdigit(ch)){",
"\t\tX = (X << 3) + (X << 1) + (ch ^ 48);",
"\t\tch = getchar();",
"\t}",
"\treturn w ? -X : X;",
"}"
]
},
"memset":{
"scope": "cpp",
"prefix": "mems",
"body": "memset($1,$2,sizeof $1);"
},
"Minimize":{
"scope": "cpp",
"prefix": "gmin",
"body": "$1 = min($1,$2);"
},
"Maximize": {
"scope": "cpp",
"prefix": "gmax",
"body": "$1 = max($1,$2);"
}
}