fork download
  1. # -*- coding: utf-8 -*-
  2. """
  3. kpdatagen.py プログラム (課題3用:SEED変更版)
  4. """
  5. import random
  6.  
  7. # グローバル変数
  8. MAXVALUE = 100 # 重さと価値の最大値
  9. N = 30 # 荷物の個数
  10. SEED = 100 # ★ここを変更しました(元は32767)
  11.  
  12. # メイン実行部
  13. random.seed(SEED) # 乱数の初期化を追加(重要)
  14.  
  15. for i in range(N):
  16. print(random.randint(0, MAXVALUE + 1),
  17. " ", random.randint(0, MAXVALUE + 1))
Success #stdin #stdout 0.13s 14204KB
stdin
Standard input is empty
stdout
18   58
58   98
22   90
50   93
44   55
64   14
68   15
10   94
58   33
6   84
82   26
42   29
39   98
26   22
18   24
44   47
80   52
26   51
59   71
35   101
48   20
83   81
15   23
0   77
50   18
99   72
20   24
21   3
85   30
57   81