#include <iostream> using namespace std; int main() { int n; long m, x; cin >> n >> m; if(n == 1) { cout << 0; } else if(n == 2 || m == 1) { cout << m; } else if(m == 2) { x = 1; x = x << n; x = x - (2 * n - 2); cout << x; } return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | #include <iostream> using namespace std; int main() { int n; long m, x; cin >> n >> m; if(n == 1) { cout << 0; } else if(n == 2 || m == 1) { cout << m; } else if(m == 2) { x = 1; x = x << n; x = x - (2 * n - 2); cout << x; } return 0; } |