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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
{
"c main body": {
"scope": "c,cpp",
"prefix": "cmain",
"body": [
"#include <stdio.h>\n",
"int main() {\n\t$0\n}"
],
},
"long long int": {
"scope": "c,cpp",
"prefix": "LL",
"body": [
"typedef long long LL;"
],
},
"define the max": {
"scope": "c,cpp",
"prefix": "MAX",
"body": [
"#define MAX $0"
],
},
"n groups of data": {
"scope": "c,cpp",
"prefix": "ng",
"body": [
"int ${1:n};",
"scanf(\"%d\", &${1:n});",
"for (int ${2:i} = 0; ${2:i} < ${1:n}; ${2:i}++) {\n\t$0\n}"
],
},
"n groups of data--": {
"scope": "c,cpp",
"prefix": "n--",
"body": [
"int ${1:n};",
"scanf(\"%d\", &${1:n});",
"while (${1:n}--) {\n\t$0\n}"
],
},
"for i++": {
"scope": "c,cpp",
"prefix": "fori",
"body": [
"for (int ${1:i} = ${2:0}; ${1:i} < ${3:size}; ${1:i}++) {\n\t$0\n}"
]
},
"for i--": {
"scope": "c,cpp",
"prefix": "for-",
"body": [
"for (int ${1:i} = ${2:size - 1}; ${1:i} >= 0; ${1:i}--) {\n\t$0\n}"
]
},
"the end of format-print": {
"scope": "c,cpp",
"prefix": "end",
"body": [
"\" \\n\"[i == ${1:size} - 1];$0"
]
},
"gcd": {
"scope": "c,cpp",
"prefix": "gcd",
"body": [
"${1:LL} gcd(${1:LL} m, ${1:LL} n) {",
"\twhile (n != 0) {",
"\t\t${1:LL} t = m % n;",
"\t\tm = n;",
"\t\tn = t;",
"\t}",
"\treturn m;",
"}"
]
},
"isPrime": {
"scope": "c,cpp",
"prefix": "isPrime",
"body": [
"int isPrime(int n) {",
"\tif (n == 1 || n == 0)",
"\t\treturn 0;",
"\tfor (int i = 2; i <= n / i; i++)",
"\t\tif (n % i == 0)",
"\t\t\treturn 0;",
"\treturn 1;",
"}"
]
}
}
|