Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- typedef long long int ll;
- #define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
- int main() {
- fastio;
- ll test;
- cin>>test;
- for(ll t=1; t<=test;t++)
- {
- vector<vector<ll>> a (40,vector<ll>(40));
- ll x,y,c,b;
- cin >> x >> y >> c >> b;
- for(ll i = 0 ; i <= x; i++) a[i][0] = 1;
- for(ll i = 0 ; i <= y ; i++) a[0][i] = 1;
- a[c][b] = 0;
- for(ll i = 1; i < x+1 ; i++) {
- for(ll j=1;j<y+1;j++) {
- if(i == c && j == b) continue;
- else{
- a[i][j]=a[i-1][j]+a[i][j-1];
- }
- }
- }
- cout<<a[x][y] << "\n";
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment