//探索なし解法 #include #define int long long using namespace std; int comb[32][32]; signed main() { int i, j, x; for (i = 0; i < 32; i++) { for (j = 0; j <= i; j++) { if (j == 0) comb[i][j] = 1; else comb[i][j] = comb[i-1][j-1] + comb[i-1][j]; } } cin >> x; if (x >= 32) { cout << 0 << endl; return 0; } cout << comb[31][x] << " " << ((x > 0) ? comb[30][x - 1] * 2147483647 : 0) << endl; return 0; }