In fact, we only need to multiply the number of all events in the first color of a lattice subgraph by 3. In this case, the color of the last grid is different from that of the first grid, so we have to remove some of the last 1. How can we find these 1 s, for more information, see the following program. In the following struct, a is the number of events in the last row, and yi is the number of events in the first row.
[Cpp]
<SPAN style = "FONT-SIZE: 18px"> # include <iostream>
Using namespace std;
Struct node {
_ Int64;
Int yi;
};
Node fuck [51];
_ Int64 f (_ int64 k)
{
_ Int64 sum = 1;
For (int j = 1; j <= k; j ++)
Sum = sum * 2;
Return sum;
}
Int main ()
{
Int I, n;
Fuck [1]. a = 1;
Fuck [1]. yi = 0;
Fuck [2]. a = 2;
Fuck [2]. yi = 0;
For (I = 3; I <= 50; I ++)
{
Fuck [I]. a = fuck [I-1]. a + (f (I-2)-fuck [I-1]. a) * 2;
Fuck [I]. yi = f (I-1)-fuck [I].;
}
While (cin> n)
{
Cout <3 * fuck [n]. a <endl;
}
Return 0;
}
</SPAN>
# Include <iostream>
Using namespace std;
Struct node {
_ Int64;
Int yi;
};
Node fuck [51];
_ Int64 f (_ int64 k)
{
_ Int64 sum = 1;
For (int j = 1; j <= k; j ++)
Sum = sum * 2;
Return sum;
}
Int main ()
{
Int I, n;
Fuck [1]. a = 1;
Fuck [1]. yi = 0;
Fuck [2]. a = 2;
Fuck [2]. yi = 0;
For (I = 3; I <= 50; I ++)
{
Fuck [I]. a = fuck [I-1]. a + (f (I-2)-fuck [I-1]. a) * 2;
Fuck [I]. yi = f (I-1)-fuck [I].;
}
While (cin> n)
{
Cout <3 * fuck [n]. a <endl;
}
Return 0;
}