-
Notifications
You must be signed in to change notification settings - Fork 0
/
testcase.py
72 lines (55 loc) · 1.46 KB
/
testcase.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import sys
import os
import random
sys.stdout = open("testcase.txt", "w")
class RandomGenerator():
def __init__(self):
pass
def integer(self, lower_bound, upper_bound):
ret = random.randint(lower_bound, upper_bound)
return ret
def array(self, array_size, lower_bound, upper_bound):
l = [0]*array_size
for index, element in enumerate(l):
l[index] = self.integer(lower_bound, upper_bound)
return l
class ListOperation():
def __init__(self):
pass
def print_space(self, l):
for element in l:
print(element, end=" ")
print()
def print_csv(self, l):
for element in l:
print(element, end=", ")
print()
class Print():
def __init__(self):
pass
def inline_print(self, n):
"""
print n elements in a line and then print an endline
"""
for i in range(n):
print()
if __name__ == "__main__":
rand = RandomGenerator()
lops = ListOperation()
t = 1000
print(t)
for __ in range(t):
num_lim = 100
# while n != 1:
n = rand.integer(1, 100)
x = rand.integer(1, num_lim)
p = rand.integer(1, n)
k = rand.integer(1, n)
print(n, end=" ")
print(x, end=" ")
print(p, end=" ")
print(k, end=" ")
print()
for ele in rand.array(n, 1, num_lim):
print(ele, end=" ")
print()