还需要考虑溢出等问题,闲来无事写了写
Func<float, float, float> a = (arg1, arg2) => 0f;//init var depth = ;
a = (lastNumber, currentNumber) =>
{
if (depth <= ) return currentNumber;
depth--;
return a(currentNumber, currentNumber + lastNumber);
}; var result = a(, );
2023-10-10 12:06:04
还需要考虑溢出等问题,闲来无事写了写
Func<float, float, float> a = (arg1, arg2) => 0f;//init var depth = ;
a = (lastNumber, currentNumber) =>
{
if (depth <= ) return currentNumber;
depth--;
return a(currentNumber, currentNumber + lastNumber);
}; var result = a(, );