'commit'
This commit is contained in:
13
TangDou/Mkx/CuoPaiGongShi.cpp
Normal file
13
TangDou/Mkx/CuoPaiGongShi.cpp
Normal file
@@ -0,0 +1,13 @@
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
typedef long long LL;
|
||||
|
||||
int main() {
|
||||
LL f[21] = {0, 0, 1}; //这个初始化很牛B的样子,放过头雁打二雁,而且f[1]=0,f[2]=1
|
||||
//错排公式,预处理
|
||||
for (int i = 3; i < 21; i++) f[i] = (i - 1) * (f[i - 1] + f[i - 2]);
|
||||
|
||||
for (int i = 1; i <= 20; i++)
|
||||
cout << "i=" << i << ",f[" << i << "]=" << f[i] << endl;
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user