UVA 11040 Add Bricks in the wall

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.