Skip to content

Commit 2676684

Browse files
committed
chore: update cpp template
1 parent 5c5e261 commit 2676684

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

.vscode/cp.code-snippets

+5
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
"body": [
1313
"#include <bits/stdc++.h>",
1414
"using namespace std;",
15+
"#define input \"input.in\"",
16+
"#define output \"output.out\"",
1517
"",
1618
"void solve() {$0}",
1719
"",
@@ -20,6 +22,9 @@
2022
" cin.tie(0);",
2123
" cout.tie(0);",
2224
"",
25+
" if (fopen(input, \"r\")) freopen(input, \"r\", stdin);",
26+
" if (fopen(output, \"r\")) freopen(output, \"w+\", stdout);",
27+
"",
2328
" int t = 1;",
2429
" cin >> t;",
2530
" while (t--) solve();",

main.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#include <bits/stdc++.h>
22
using namespace std;
3+
#define input "input.in"
4+
#define output "output.out"
35

46
void solve() {}
57

@@ -8,6 +10,9 @@ int main() {
810
cin.tie(0);
911
cout.tie(0);
1012

13+
if (fopen(input, "r")) freopen(input, "r", stdin);
14+
if (fopen(output, "r")) freopen(output, "w+", stdout);
15+
1116
int t = 1;
1217
cin >> t;
1318
while (t--) solve();

0 commit comments

Comments
 (0)