>>461 import java.util.*; public class Betty { Set<String> l = new TreeSet<String>(); public void add(int x, int y, int z) { if (x == y || y == z || z == x) return; l.add(x + "-" + y + "-" + z); } public int size() {return l.size();} public Set<String> get() {return l;} public static void main(String[] args) { int h = Integer.parseInt(args[0]); int c = args.length < 2 ? 5 : Integer.parseInt(args[1]); if (h < 8 || 18 < h) throw new IllegalArgumentException("8-18"); Betty b = new Betty(); while (b.size() < c) b.add(r(h), r(h), r(h)); for (String s : b.get()) System.out.println(s); } static int r(int c) {return (int)(Math.random() * c) + 1;} }