the first game 4 H the building blocksTitle description
Building blocks for you should be very familiar with, we can use the building blocks to build out a variety of models, different people to build the model will be different, it's not that small is kakashi and small partners playing with blocks!
Iron man teacher saw the children playing with blocks, it poses a conundrum for everyone: given a few square blocks, building blocks of the three dimensions of positive integer Xi, respectively, Yi Zi, each kind of building blocks can be thought of as an unlimited number of, and agreed upon in the process of building the following conditions:
1. Set up the model of each layer can only use a block;
2. Each layer of the model of the building blocks of the bottom must be smaller than the lower level, of course, building blocks of the bottom can be as one of six surface,
So how to build, to make the model of the highest?
Enter
The first line of a number N, represent different blocks of species (N
=1000)The following N lines, each line describes a building block,
Xi, Yi, Zi (& lt;=100) respectively, the length of the trilateral
O
A line a number M, under the condition of a given can build the highest model of height,
The sample input
1
10 20 30
Sample output
40
CodePudding user response:
# includeusing namespace std;
Int n, I, j, f [3009];
Struct stu {
int a;
int b;
int c;
} a, [3009].
Bool CMP (stu a, stu b) {
Return a.a & lt; B.a.
}
Int main ()
{
Cin> n;
for(i=1; i<=n; I++) {
Cin> A [I] a> A [I] b> A [I] c;
A [n + I] a=a [I]. B;
A [n + I]. B=a [I] c.
A [n + I]. C=a [I] a;
A (2 * n + I] a=a [I] c.
A (2 * n + I]. B=a [I] a;
A (2 * n + I]. C=a [I]. B;
}
N=n * 3;
for(i=1; i<=n; I++)
If (a [I] a> A [I]. B) swap (a [I] a, a [I]. B);
Sort (a + 1, a + 1 + n, CMP);
F [1]=[1]. A c;
for(i=2; i<=n; I++) {
F=[I] a [I] c.
For (j=1; j<=I - 1; J++)
If (a [j] a[I] f=Max (f [I], [j] f + a [I] c);
}
Cout
}
CodePudding user response:
60 points WACodePudding user response:
Didn't understand well, the data in the code 3009 how to calculate?CodePudding user response:
Up is never wrong