https://codeforces.com/gym/101955
C题
题意:输入n,k,q,问有多少1~n的排列,使得在把前k个按升序排好序后,最长上升子序列的长度不低于n-1.
暴力打表找规律,得出方程。
打表代码:
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <iterator>
using namespace std;
int num;
int f[10],b[10];
void dfs(int a[], int k, int m, int w){
if (k==m) {
copy(a+1, a+m+1, b+1); //流迭代器
// copy(b+1, b+m+1, ostream_iterator<int>(cout, " ")); //流迭代器
// printf("\n");
sort(b+1,b+w+1);
for (int i=1; i<=m; i++) f[i]=1;
for (int i=2; i<=m; i++){
for (int j=i-1; j>=1; j--)
{