社区讨论

赠送数据生成器

P4116Qtree3参与者 2已保存回复 2

讨论操作

快速查看讨论及其快照的属性,并进行相关操作。

当前回复
2 条
当前快照
1 份
快照标识符
@lth0dx6e
此快照首次捕获于
2024/03/07 17:11
2 年前
此快照最后确认于
2024/03/07 19:59
2 年前
查看原帖
CPP
#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调大一些

回复

2 条回复,欢迎继续交流。

正在加载回复...