/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
{
int num = 8;
long[] ans = new long[num];
for (int i = 0; i < num; i++)
ans[i] = 0;
ans[0] = ans[1] = 1;
for (int i = 2; i < num; i++) {
System.
out.
println("R(" + i
+ ") = >"); for (int j = 0; j < i / 2; j++) {
ans[i] += ans[j];
System.
out.
println("\t{" + j
+ "} + R(" + (j
) + ") = " + ans
[j
] + ""); }
int j = i / 2;
if (i % 2 == 0) {
ans[i] += ans[j] - 1;
System.
out.
println("\t{" + j
+ "} + R(" + (j
) + ") - 1 = " + (ans
[j
] - 1) + ""); }
else {
ans[i] += ans[j];
System.
out.
println("\t{" + j
+ "} + R(" + (j
) + ") = " + ans
[j
] + ""); }
System.
out.
println("\t = > " + ans
[i
]); }
}
}
LyogcGFja2FnZSB3aGF0ZXZlcjsgLy8gZG9uJ3QgcGxhY2UgcGFja2FnZSBuYW1lISAqLwoKaW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CgovKiBOYW1lIG9mIHRoZSBjbGFzcyBoYXMgdG8gYmUgIk1haW4iIG9ubHkgaWYgdGhlIGNsYXNzIGlzIHB1YmxpYy4gKi8KY2xhc3MgSWRlb25lCnsKCXB1YmxpYyBzdGF0aWMgdm9pZCBtYWluIChTdHJpbmdbXSBhcmdzKSB0aHJvd3MgamF2YS5sYW5nLkV4Y2VwdGlvbgoJewoJCWludCBudW0gPSA4OwoJCWxvbmdbXSBhbnMgPSBuZXcgbG9uZ1tudW1dOwoJCQoJCWZvciAoaW50IGkgPSAwOyBpIDwgbnVtOyBpKyspCgkJCWFuc1tpXSA9IDA7CgkJCQoJCWFuc1swXSA9IGFuc1sxXSA9IDE7CgkJCgkJZm9yIChpbnQgaSA9IDI7IGkgPCBudW07IGkrKykgewoJCQlTeXN0ZW0ub3V0LnByaW50bG4oIlIoIiArIGkgKyAiKSA9ID4iKTsKCQkJZm9yIChpbnQgaiA9IDA7IGogPCBpIC8gMjsgaisrKSB7CgkJCQlhbnNbaV0gKz0gYW5zW2pdOwoJCQkJU3lzdGVtLm91dC5wcmludGxuKCJcdHsiICsgaiArICJ9ICsgUigiICsgKGopICsgIikgPSAiICsgYW5zW2pdICsgIiIpOwoJCQl9CgkJCWludCBqID0gaSAvIDI7CgkJCWlmIChpICUgMiA9PSAwKSB7CgkJCQlhbnNbaV0gKz0gYW5zW2pdIC0gMTsKCQkJCVN5c3RlbS5vdXQucHJpbnRsbigiXHR7IiArIGogKyAifSArIFIoIiArIChqKSArICIpIC0gMSA9ICIgKyAoYW5zW2pdIC0gMSkgKyAiIik7CgkJCX0KCQkJZWxzZSB7CgkJCQlhbnNbaV0gKz0gYW5zW2pdOwoJCQkJU3lzdGVtLm91dC5wcmludGxuKCJcdHsiICsgaiArICJ9ICsgUigiICsgKGopICsgIikgPSAiICsgYW5zW2pdICsgIiIpOwoJCQl9CgkJCQkKCQkJU3lzdGVtLm91dC5wcmludGxuKCJcdCA9ID4gIiArIGFuc1tpXSk7CgkJfQoJCgkJU3lzdGVtLm91dC5wcmludGxuKEFycmF5cy50b1N0cmluZyhhbnMpKTsJCgl9Cn0=
R(2) = >
{0} + R(0) = 1
{1} + R(1) - 1 = 0
= > 1
R(3) = >
{0} + R(0) = 1
{1} + R(1) = 1
= > 2
R(4) = >
{0} + R(0) = 1
{1} + R(1) = 1
{2} + R(2) - 1 = 0
= > 2
R(5) = >
{0} + R(0) = 1
{1} + R(1) = 1
{2} + R(2) = 1
= > 3
R(6) = >
{0} + R(0) = 1
{1} + R(1) = 1
{2} + R(2) = 1
{3} + R(3) - 1 = 1
= > 4
R(7) = >
{0} + R(0) = 1
{1} + R(1) = 1
{2} + R(2) = 1
{3} + R(3) = 2
= > 5
[1, 1, 1, 2, 2, 3, 4, 5]