#include "bits/stdc++.h" using namespace std; //諸機能 #pragma region MACRO #define putans(x) std::cerr << "answer: " ; cout << (x) << endl #define dputans(x) std::cerr << "answer: "; cout << setprecision(10) << (double)(x) << endl #define REP(i,a,n) for(int i=(a); i<(int)(n); i++) #define RREP(i,a,n) for(int i=(int)(n-1); i>= a; i--) #define rep(i,n) REP(i,0,n) #define rrep(i,n) RREP(i,0,n) #define all(a) begin((a)),end((a)) #define mp make_pair #define exist(container, n) ((container).find((n)) != (container).end()) #define substr(s,i,l) string((s), (i), (l)) #define tos(x) (to_string((x))) #ifdef _DEBUG //ファイルからテストデータを読み込む std::ifstream ifs("data.txt"); #define put ifs >> #else //いい感じにやる #define put cin >> #endif #pragma endregion //デバッグなどの支援 #pragma region CODING_SUPPORT #define dbg(var0) { std::cerr << ( #var0 ) << "=" << ( var0 ) << endl; } #define dbg2(var0, var1) { std::cerr << ( #var0 ) << "=" << ( var0 ) << ", "; dbg(var1); } #define dbg3(var0, var1, var2) { std::cerr << ( #var0 ) << "=" << ( var0 ) << ", "; dbg2(var1, var2); } #define dbgArray(a,n) {std::cerr << (#a) << "="; rep(i,n){std::cerr <<(a[i])<<",";} cerr< pii; typedef pair pss; typedef pairpis; typedef vector vs; typedef vector vi; #pragma endregion //諸々の定数(書き換える可能性ある) #pragma region CONST_VAL #define PI (2*acos(0.0)) #define EPS (1e-9) #define MOD (ll)(1e9 + 7) #define INF (ll)(1e9) #pragma endregion bool used[20]; int N; int K; int f(bool sorted,int last,int count) { dbgArray(used, 5); int ans = 0; if (count == N) { dbgArray(used,5); dbg("ok"); return 1; } if (sorted) { if (( last == 0 )) { dbg("ng"); return 0; } else { RREP(i,0,last) { if (!used[i]) { used[i] = true; ans += f(true, i, count + 1); used[i] = false; break; } } } } else { REP(i,0,last){ used[i] = true; ans += f(false, i, count + 1); used[i] = false; } ans += 1; } return ans; } int main() { int n, k; put n >> k; N = n; K = k-1; //used[k-1] = true; if (n = 2) { putans(0); goto END; } putans(1<<(k-1)); END: return 0; }