赠送数据生成器
  • 板块P4116 Qtree3
  • 楼主qtanglani
  • 当前回复2
  • 已保存回复2
  • 发布时间2024/3/7 17:11
  • 上次更新2024/3/7 19:59:17
查看原帖
赠送数据生成器
988040
qtanglani楼主2024/3/7 17:11
#include<iostream>
#include<time.h>
using namespace std;
int main()
{
    freopen("data.in","w",stdout);
    srand(time(0));
    int n=rand()%8+1;
    int m=rand()%30+1;
    cout<<n<<" "<<m<<endl;
    for(int i=2;i<=n;i++)
    {
        int fa=rand()%(i-1)+1;
        cout<<fa<<" "<<i<<endl;
    }
    for(int i=1;i<=m;i++)
    {
        int op=rand()%2;
        if(op==0)
            cout<<op<<" "<<rand()%n+1<<endl;
        else
            cout<<op<<" "<<rand()%n+1<<endl;
    }
}

如果拍不出来建议m调大一些

2024/3/7 17:11
加载中...