Skip to content

Commit 08171f6

Browse files
authored
Update README.md
1 parent e566aa1 commit 08171f6

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,31 @@ By Luogu
1818
- 生成一些随机多边形,并且可以求面积、周长等
1919
- 从字典生成随机字符串、单词、句子、段落
2020

21+
**使用范例**
22+
```python
23+
#!/usr/bin/env python
24+
25+
from cyaron import * # 引入CYaRon的库
26+
27+
_n = ati([0, 7, 50, 1E4]) # ati函数将数组中的每一个元素转换为整形,方便您可以使用1E4一类的数来表示数据大小
28+
_m = ati([0, 11, 100, 1E4])
29+
30+
# 这是一个图论题的数据生成器,该题目在洛谷的题号为P1339
31+
for i in range(1, 4): # 即在[1, 4)范围内循环,也就是从1到3
32+
test_data = IO(file_prefix="heat", data_id=i) # 生成 heat[1|2|3].in/out 三组测试数据
33+
34+
n = _n[i] # 点数
35+
m = _m[i] # 边数
36+
s = randint(1, n) # 源点,随机选取一个
37+
t = randint(1, n) # 汇点,随机选取一个
38+
test_data.input_writeln(n, m, s, t) # 写入到输入文件里,自动以空格分割并换行
39+
40+
graph = Graph.graph(n, m, weight_limit=5) # 生成一个n点,m边的随机图,边权限制为5
41+
test_data.input_writeln(graph) # 自动写入到输入文件里,默认以一行一组u v w的形式输出
42+
43+
test_data.output_gen("D:\\std_binary.exe") # 标程编译后的可执行文件,不需要freopen等,CYaRon自动给该程序输入并获得输出作为.out
44+
```
45+
2146
**快速上手指南**
2247

2348
你可以下载github源代码 https://github.com/luogu-dev/cyaron ,或者`pip install cyaron`。在此之前,需要准备好python2/3。

0 commit comments

Comments
 (0)