CF Tool 使用教程

CF Tool 使用教程

CF Tool 使用教程

徐晨轩✅

·

2022-03-16 13:57:58

·

个人记录

CF Tool 下载地址

安装

第一步:

下载后解压缩,接着会看到一个文件 cf.exe,将其拷贝至 C:\Users\*\AppData\Local\CF Tools,其中 * 为用户名(如 C:\Users\徐晨轩\AppData\Local\CF Tools)。

第二步:

在搜索框里搜索“环境变量”,选择“编辑系统环境变量”。

点击“环境变量”。

在“XXX 的用户变量”中找到 Path。双击打开。

点击新建,输入 cf.exe 保存的路径。

完成后单击“确定”。

接下来,在“系统变量”中找到 Path。做同样的操作。

完成后单击“确定”退出。

第三步:

打开 Windows Terminal(Win11) or CMD(Win10 or lower)(使用管理员模式打开),输入 cf,如果能看到下面的信息说明已安装成功。

Usage:

cf config

cf submit [-f ] [...]

cf list [...]

cf parse [...]

cf gen []

cf test []

cf watch [all] [...]

cf open [...]

cf stand [...]

cf sid [...]

cf race [...]

cf pull [ac] [...]

cf clone [ac] []

cf upgrade

如果没有,请检查前面的设置是否成功。

配置

在命令行中输入 cf config,回车。

Configure the tool

0) login

1) add a template

2) delete a template

3) set default template

4) run "cf gen" after "cf parse"

5) set host domain

6) set proxy

7) set folders' name

Please choose one (index):

输入 0,回车。

然后输入 Codeforces 的用户名和密码(密码不可见,只要正确输入即可)。

当显示

Succeed!!

Welcome (用户名)~

时,表示登录成功。如果显示

Not logged in

则表明登录失败,请检查用户名/密码。

接着,新建一个文件 template.cpp,键入模板代码。推荐:

/*

Created By: CF Tool

User Name: $%U%$

Create Time: $%Y%$-$%M%$-$%D%$ $%h%$:$%m%$:$%s%$

*/

#include

using namespace std;

int main()

{

ios::sync_with_stdio(false);

cin.tie(NULL);cout.tie(NULL);

return 0;

}

再次键入 cf config,回车,输入 1,回车。

Add a template

Language list:

14: ActiveTcl 8.5

33: Ada GNAT 4

18: Befunge

9: C# Mono 5.18

52: Clang++17 Diagnostics

28: D DMD32 v2.086.0

3: Delphi 7

39: FALSE

25: Factor

4: Free Pascal 3.0.2

45: GNU C++11 5 ZIP

42: GNU G++11 5.1.0

50: GNU G++14 6.4.0

54: GNU G++17 7.3.0

43: GNU GCC C11 5.1.0

32: Go 1.12.6

12: Haskell GHC 8.6.3

15: Io-2008-01-07 (Win32)

47: J

36: Java 1.8.0_162

60: Java 11.0.5

46: Java 8 ZIP

34: JavaScript V8 4.8.0

48: Kotlin 1.3.10

56: Microsoft Q#

2: Microsoft Visual C++ 2010

59: Microsoft Visual C++ 2017

38: Mysterious Language

55: Node.js 9.4.0

19: OCaml 4.02.1

22: OpenCobol 1.0

6: PHP 7.2.13

51: PascalABC.NET 3.4.2

13: Perl 5.20.1

44: Picat 0.9

17: Pike 7.8

40: PyPy 2.7 (7.2.0)

41: PyPy 3.6 (7.2.0)

7: Python 2.7.15

31: Python 3.7.2

27: Roco

8: Ruby 2.0.0p645

49: Rust 1.35.0

20: Scala 2.12.8

26: Secret_171

Select a language (e.g. "42"):

输入 54,回车。

GNU G++17 7.3.0

Template:

You can insert some placeholders into your template code. When generate a code from the

template, cf will replace all placeholders by following rules:

$%U%$ Handle (e.g. xalanq)

$%Y%$ Year (e.g. 2019)

$%M%$ Month (e.g. 04)

$%D%$ Day (e.g. 09)

$%h%$ Hour (e.g. 08)

$%m%$ Minute (e.g. 05)

$%s%$ Second (e.g. 00)

Template absolute path(e.g. "~/template/io.cpp"):

输入 template.cpp 所在路径(例如 C:\Users\徐晨轩\AppData\Local\CF Tools\template.cpp),回车。

The suffix of template above will be added by default.

Other suffix? (e.g. "cxx cc"), empty is ok:

直接回车。

Template's alias (e.g. "cpp" "py"):

输入 cpp,回车。

Script in template:

Template will run 3 scripts in sequence when you run "cf test":

- before_script (execute once)

- script (execute the number of samples times)

- after_script (execute once)

You could set "before_script" or "after_script" to empty string, meaning not executing.

You have to run your program in "script" with standard input/output (no need to redirect).

You can insert some placeholders in your scripts. When execute a script,

cf will replace all placeholders by following rules:

$%path%$ Path to source file (Excluding $%full%$, e.g. "/home/xalanq/")

$%full%$ Full name of source file (e.g. "a.cpp")

$%file%$ Name of source file (Excluding suffix, e.g. "a")

$%rand%$ Random string with 8 character (including "a-z" "0-9")

Before script (e.g. "g++ $%full%$ -o $%file%$.exe -std=c++11"), empty is ok:

输入 g++ $%full%$ -o $%file%$.exe -std=c++14 -Wall,回车。

Script (e.g. "./$%file%$.exe" "python3 $%full%$"):

输入 ./$%file%$.exe,回车。

After script (e.g. "rm $%file%$.exe" or "cmd.exe /C del $%file%$.exe" in windows), empty is ok:

输入 cmd.exe /C del $%file%$.exe,回车。

Make it default (y/n)?

输入 y,回车。

使用

命令解释

cf race (contest_index):表示下载 https://codeforces.com/contest/(contest_index) 比赛的样例等文件(默认保存至 ~/codeforces/contest/(contest_index)/)。

cf submit:表示提交当前目录下的代码(如果有多个,会提示选择哪一个)。

cf submit -f (file):表示提交名为 (file) 的文件。

cf submit (contest_index) (problem):表示提交第 (contest_index) 次比赛的 (problem) 题(如 cf submit 100 A)。

相关推荐

韩国男星服兵役的那些事,你知道多少?原来这些中国名人曾当过兵
精靈小姐瘦不了
365bet足球直播

精靈小姐瘦不了

📅 08-24 👁️ 1516
淘宝店遇到恶意买家记得打标,投诉,曝光!1.打标步骤:千牛工作 ...