Created
October 1, 2018 08:18
-
-
Save bavernet/8f15b72c11c6ddf2d53e05909b7d40e3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
#define N_MAX 30 | |
static int C[N_MAX+1][N_MAX+1]; | |
int main(void) { | |
cout.sync_with_stdio(false); | |
cin.tie(nullptr); | |
C[0][0] = 1; | |
for (int i = 1; i <= N_MAX; ++i) { | |
C[i][0] = C[i][i] = 1; | |
for (int j = 1; j < i; ++j) | |
C[i][j] = C[i-1][j-1] + C[i-1][j]; | |
} | |
int nTests; | |
cin >> nTests; | |
while (nTests--) { | |
int n, m; | |
cin >> n >> m; | |
cout << C[m][n] << '\n'; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment