社区讨论

赠送数据生成器

P3979遥远的国度参与者 1已保存回复 0

讨论操作

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

当前回复
0 条
当前快照
1 份
快照标识符
@ltpg0msd
此快照首次捕获于
2024/03/13 14:51
2 年前
此快照最后确认于
2024/03/13 17:35
2 年前
查看原帖
CPP
#include<iostream>
#include<time.h>
using namespace std;
int main()
{
    freopen("data.in","w",stdout);
    srand(time(0));
    int n=rand()%6+1;
    int q=rand()%6+1;
    cout<<n<<" "<<q<<endl;
    for(int i=2;i<=n;i++)
        cout<<i<<" "<<rand()%(i-1)+1<<endl;
    for(int i=1;i<=n;i++)
        cout<<rand()%10+1<<" ";
    cout<<endl;
    cout<<rand()%n+1<<endl;
    for(int i=1;i<=q;i++)
    {
        int op=rand()%3+1;
        cout<<op<<" ";
        if(op==1)
            cout<<rand()%n+1<<endl;
        if(op==2)
            cout<<rand()%n+1<<" "<<rand()%n+1<<" "<<rand()%10+1<<endl;
        if(op==3)
            cout<<rand()%n+1<<endl;
    }
}

回复

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

正在加载回复...