网站分类标准,外贸一般在哪个网站做的,女性做网站,北京建设网站最多只有k个位置满足#xff0c;ai ! i 所以从0-k进行遍历#xff0c;对于kj#xff1a; 0时#xff0c;所有位置上的数字都等于i#xff0c;只有一种 1时#xff0c;没有 2时#xff0c;排列只有两种#xff0c;1 2 或者 2 1#xff0c;只有一种情况满足 同理3和4可以…最多只有k个位置满足ai ! i 所以从0-k进行遍历对于kj 0时所有位置上的数字都等于i只有一种 1时没有 2时排列只有两种1 2 或者 2 1只有一种情况满足 同理3和4可以分别只有29种 具体细节见代码
#include math.h
#include stdio.h
#include algorithm
#include cstring
#include iostream
using namespace std;
const int N 1e5 10;
#define de(x) cout x ;
#define sf(x) scanf(%d, x);
#define Pu puts();
#define ll long long
// int n, m, ans;
ll n, k, ans;
ll C(ll x, ll y) { // 组合数量ll res 1;for (ll i 1; i y; i) {res * (x - i 1);res / i;}return res;
}
int main() {cin n k;ans 1;// 最多只有k个位置满足ai ! i// 所以从0-k进行遍历for (ll i 2; i k; i) {if (i 2) {ans C(n, i) * 1;} else if (i 3) {ans C(n, i) * 2;} else if (i 4) {ans C(n, i) * 9;}}cout ans endl;return 0;
}