Tsukihjy/testcase / testcase-data /method /ALGO /gen_input_sample.py
Tsukihjy's picture
download
raw
1.45 kB
# import random
# def gen_input():
# # Randomly choose the number of piles, N
# N = random.randint(1, 10)
# # Generate N random numbers for the piles, each between 1 and 1000
# piles = [random.randint(1, 1000) for _ in range(N)]
# # Randomly choose the number of types of stones that can be taken, M
# M = random.randint(1, 10)
# # Generate M unique random numbers for the types of stones that can be taken, each between 1 and 10
# # Ensure they are sorted in increasing order
# take_options = sorted(random.sample(range(1, 11), M))
# # Construct the input string
# input_str = f"{N}\n"
# input_str += "\n".join(map(str, piles)) + "\n"
# input_str += f"{M}\n"
# input_str += "\n".join(map(str, take_options)) + "\n"
# return input_str
import random
def gen_input(upper_limit=2 * 10**9):
# Generate a1 and b0 within the upper limit
a1 = random.randint(1, upper_limit)
b0 = random.randint(1, upper_limit)
# Ensure a0 is divisible by a1
a0 = a1 * random.randint(1, upper_limit // a1)
# Ensure b1 is divisible by b0
b1 = b0 * random.randint(1, upper_limit // b0)
# Format the input as a string
input_str = f"{a0} {a1} {b0} {b1}\n"
return input_str
def batch_gen_inputs(batch_size=10):
inputs = []
for _ in range(batch_size):
inputs.append(gen_input())
return inputs
batch_gen_inputs(1)

Xet Storage Details

Size:
1.45 kB
·
Xet hash:
0ce23f25064d9965d2e99cc5cb0a3b53882af446314f5965b0f04e4207a15e5a

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.