aboutsummaryrefslogtreecommitdiff
path: root/works/life/lanqiao-selection-match/generator/A.rb
blob: 9b0bf1ee591206d12e4df30728bc15fad0283408 (plain)
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
#!/usr/bin/env ruby
# frozen_string_literal: true

# @param file [File]
def generate(count, file)
  range = -100_000..100_000
  prng = Random.new
  file.write(count)
  file.write("\n")
  count.times do
    file.write(prng.rand(range))
    file.write(' ')
  end
end

3.times do |i|
  file = File.open("A-#{i + 1}.in", 'w')
  count = case i
          when 0 then 1000
          when 1 then 10_000
          else 100_000
          end
  generate count, file
  file.close
end