NOI Linux 个人使用方式 2021

· · 个人记录

2021 CSP 的写题方式,个人认为比较舒服。

编辑器为 VSCode。

代码模板(部分):

#ifndef NO_FREOPEN
#define FREOPEN(x) freopen(#x".in", "r", stdin); freopen(#x".out", "w", stdout);
#else
#define FREOPEN(x) freopen("in.in", "r", stdin); freopen("out.out", "w", stdout);
#endif

调试编译:function dcompile { g++ -g -DNO_FREOPEN -Wall -Wextra $1.cpp -o $1; }(注意不要忘了空格)

编译:function compile { g++ -O2 -Wall -Wextra $1.cpp -o $1; }

使用方式:dcompile test/compile test

运行:./test

(图中题目为 CSP-J 2021 T3,代码为考场代码,图里的脚本和上面给出的有一定差距)

对比:diff -Z out.out ans.ans