def p2080(): if not os.path.exists('2080'): os.mkdir('2080') os.system('g++ code/2080.cpp') # case 1 1 #简单输入 io = IO(file_prefix="2080/", data_id=1) io.input_writeln('ABCBDABF') io.input_writeln('BDCABAF') io.output_gen('./a.out') # case 2~10 #小数据输入 for x in range(2, 11): io = IO(file_prefix="2080/", data_id=x) a = String.random(randrange(7, 11), charset=cyaron.ALPHABET_CAPITAL) b = String.random(randrange(7, 11), charset=cyaron.ALPHABET_CAPITAL) io.input_writeln(a) io.input_writeln(b) io.output_gen('./a.out') # case 11~20 #大数据输入 for x in range(11, 21): io = IO(file_prefix="2080/", data_id=x) a = String.random(randrange(490, 501), charset=cyaron.ALPHABET_CAPITAL) b = String.random(randrange(490, 501), charset=cyaron.ALPHABET_CAPITAL) io.input_writeln(a) io.input_writeln(b) io.output_gen('./a.out') open('2080/scores', 'w').write(open('raw_data/scores/2080').read())
def p1008(): if not os.path.exists('1008'): os.mkdir('1008') os.system('g++ code/1008.cpp') # case 1 1 #简单输入 io = IO(file_prefix="1008/", data_id=1) io.input_writeln('1') io.input_writeln('3') io.input_writeln('ab') io.input_writeln('ab') io.input_writeln('bc') io.output_gen('./a.out') # case 2~11 # n = 2 for case_id in range(2, 11): io = IO(file_prefix="1008/", data_id=case_id) io.input_writeln(20) for x in range(20): io.input_writeln(2) b = String.random(randrange(90, 100), charset=cyaron.ALPHABET_CAPITAL) c = String.random(randrange(90, 100), charset=cyaron.ALPHABET_CAPITAL) io.input_writeln(b) io.input_writeln(c) io.output_gen('./a.out') # case 11~20 #边界输入 for case_id in range(11, 21): io = IO(file_prefix="1008/", data_id=case_id) io.input_write( open('raw_data/1008/data{}.in'.format(case_id - 10)).read()) io.output_gen('./a.out') open('1008/scores', 'w').write(open('raw_data/scores/1008').read())
def test_random_word(self): test = String.random(100, charset="abc") self.assertTrue(all(a in "abc" for a in test))
from cyaron import String from cyaron import IO import random cstr = [] for cases in range(13, 21): io = IO('delta' + str(cases) + '.in', 'delta' + str(cases) + '.out') n = random.randint(301, 1000) #print(n) io.input_writeln(n) for i in range(0, n): cstr.append(String.random(random.randint(3, 10))) #print(cstr[i]) io.input_writeln(cstr[i]) pass for i in range(0, n): cstr.append(String.random(random.randint(3, 10))) pass an = random.randint(5001, 100000) #print(an) io.input_writeln(an) for i in range(0, an): #print(String.random(None,charset=cstr)) io.input_writeln(String.random(None, charset=cstr)) pass pass
def test_random_word_from_dict(self): my_dict = ["lorem", "ipsum", "dolor", "sit", "amet"] test = String.random(None, charset=my_dict) self.assertTrue(test in my_dict)