随机生成树 C++复制#include <bits/stdc++.h> using namespace std; int n=10,w=20; int main() { mt19937 rd(time(0)); cout << n << '\n'; for(int i=2;i<=n;i++) cout << rd()%(i-1)+1 << ' ' << i << ' ' << rd()%w << '\n'; return 0; }