1, the number of right-angled triangle
Huawei written: the number of right-angled triangle
i + j + k = p, 0 <i <= j <k, by solving the inequality can be obtained: i <p / 3, j <p / 2.
2, adjacent the matrix is determined
https://www.cnblogs.com/LJ-LJ/p/11455415.html
Subject description:
A matrix 5 * 5, take the adjacent (two members have a side are the same) of 6, enter a list of six members, to determine whether to meet?
Matrix members are as follows:
[[1,2,3,4,5],
[11,12,13,14,15],
[21,22,23,24,25],
[31,32,33,34,35],
[41,42,43,44,45]].
Enter a description:
It contains six members of the array matrix, such as: 1,2,3,4,5,11 with a space, supports multi-line
1,2,3,4,5,11
1,2,11,14,25,15
Output Description:
Meet the output 1, output 0 otherwise, each line of input output
1
0
Remarks:
Enter no legal judgment, each member is not repeated.
Analysis of ideas:
Use disjoint-set to achieve. A set of array of length 6, wherein each individual member of the group, determines the next adjacent twenty-two whether, if the adjacent merged into one group. Finally, the group determines whether there is isolated, if output 0, output 1 otherwise.