The numbers on the bricks can eventually be seen as the linear combination of the last line, with a maximum of 9 independent elements.
In the general practice of this type of problem, the linear combination can list the equation and then the Gaussian elimination element.
For this problem, just determine the last line of the remaining 4 variables, for the last line of J position, it on the position of a number and the number of contributions
The number of schemes equal to the path to that location can be found to be the Yang Hui triangle. The number of the second-to-last row is sufficient to determine the remaining variables, and the scheme for x to the corresponding position Y is 2.
x = (y-xleft-xright)/2.
/**********************************************************--------------CRISPR---------------* * Author Abyssalfish ***********************************************************/#include<bits/stdc++.h>using namespaceStd;typedefLong Longll;intb[9][9];//#define LOCALintMain () {#ifdef LOCAL freopen ("In.txt","R", stdin);#endif intT, I, J; scanf"%d",&T); while(t--){ for(i =6; i--;) scanf ("%*d"); for(i =0; I <7; i + =2) scanf ("%d", b[6]+i); for(i =0; I <9; i + =2) scanf ("%d", b[8]+i); for(i =1; I <9; i + =2) {b[8][i] = (b[6][i-1]-b[8][i-1]-b[8][i+1]) >>1; } for(i =8; i--;){ for(j =0; J <= I; J + +) {B[i][j]= b[i+1][J] + b[i+1][j+1]; } } for(i =0; I <9; i++){ for(j =0; J <= I; J + +) {printf ("%d%c", b[i][j],j==i?'\ n':' '); } } } return 0;}
UVA 11040 Add Bricks in the wall