luogu-dev / cyaron

CYaRon: Yet Another Random Olympic-iNformatics test data generator
GNU Lesser General Public License v3.0
1.32k stars 164 forks source link

为什么输出文件不完整 #57

Closed Thomasguo666 closed 5 years ago

Thomasguo666 commented 5 years ago
from cyaron import * 
_n = ati([0, 10, 30, 50, 100, 1000, 10000, 20000, 100000]) 
for i in range(1, 8): 
    test_data = IO(file_prefix="random", data_id=i) 
    n = _n[i]
    a = randint(1, 198439)
    b = randint(1, 198439)
    x = randint(1, 198439)
    mod=198439
    test_data.input_writeln(n)
    test_data.output_writeln(a,b)
    for j in range(1, n*2+1):
        if j%2==1:
            test_data.input_writeln(x)
        else:
            test_data.output_writeln(x)
        x=((b-x)*a%mod+mod)%mod

使用这个程序,第七个数据点一般不会输出20001行,而是19000行左右。

lin-toto commented 5 years ago

如果你是直接在命令行执行的,那最后一组输入输出文件缓冲区没有完全写入到文件里。

你自己close一下或者用with语法就可以了