4 条题解

  • 1
    @ 2023-4-1 19:52:23
    #include <queue>
    #include <math.h>
    #include <stack>
    #include <stdio.h>
    #include <iostream>
    #include <vector>
    #include <iomanip>
    #include <string.h>
    #include <algorithm>
    using namespace std;
    #define LL long long
    const int N = 1e5 + 10;
    const int INF = 0x3f3f3f3f;
    int a[N];
    int n ,m;
    void f(int last , int step)
    {
    	if(step == m)
    	{
    		for(int i = 0 ; i < step ; i++)
    			cout << a[i] << " ";
    		cout << endl;
    		return ;
    	}
    	for(int i = last +1 ; i <= n ; i++)
    	{
    		a[step] = i;
    		f(i , step + 1);
    	}
    }
    int main()
    {
    	cin >> n >> m;
    	f(0 , 0);
    	return 0;
    }
    

    信息

    ID
    6
    时间
    1000ms
    内存
    128MiB
    难度
    3
    标签
    递交数
    419
    已通过
    241
    上传者