OJ题目输出的生成

时间:2020-06-17 00:32:52   收藏:0   阅读:107

input随机数据生成示例:

void data_get_in(){
    srand((unsigned int)time(NULL));
    freopen("C:\\Users\\gzr2018\\Desktop\\1.in","w",stdout);
    int len=0;
    cout<<9<<endl;
    for(int i=0;i<9;i++){
        string s="";
        if(i==0)len=1;
        else if(i==1)len=2;
        else if(i==2)len=3;
        else len=rand();
        while(len--){
            s+=ch[rand()%10];
        }
        cout<<s<<endl;
    }
}

output数据生成:
这里输出生成再在ide窗口,如果需要保存文件,可以使用上面的方法。gao()函数就是你的标程。

int main()
{
    freopen("C:\\Users\\gzr2018\\Desktop\\1.in","r",stdin);
    int T;
    scanf("%d",&T);
    while(T--){
        string s;
        cin>>s;
        cout<<gao(s)<<endl;
    }
    return 0;
}

原文:https://www.cnblogs.com/gzr2018/p/13149971.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!