datagen.cpp

来自「这是经典的背包问题」· C++ 代码 · 共 22 行

CPP
22
字号
#include<iostream>
#include<stdio.h>
using namespace std;
#define n 100
#define W 10000
#define P 10000
#define c 200000
int main()
{
    int i,w,p;
    freopen("input5.txt","w",stdout);
    srand(5);
    cout<<n<<" "<<c<<endl;
    for(i=1;i<=n;i++)
    {
        w=rand()%W+1;
        p=rand()%P+1;
        cout<<w<<" "<<p<<endl;
    }
    return 0;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?