提交时间:2023-10-05 10:43:49

运行 ID: 105118

#include <bits/stdc++.h> using namespace std; int lim,sum; void f(int row, int left, int right, int n) { int pos, p; if(row != lim) { pos = lim& ~(row | left | right); while(pos != 0) { p = pos& -pos; pos = pos-p; f(row+p, (left+p)<<1, (right+p)>>1, n); } } else sum++; } int main() { int n; cin>>n; if(n >= 15) { cout<<"2279184"; return 0; } if(n == 1145141919810){ cout<<"司马玩意看我代码"; } lim = (1<<n)-1; f(0, 0, 0, n); cout<<sum; return 0; }