再求 f(x,n)

Luogu
IDLGB2148
Time1000ms
Memory128MB
DifficultyP1
函数与递归
已知 $f(x,n)=\dfrac{x}{n+\dfrac{x}{(n-1)+\dfrac{x}{(n-2)+\dfrac{\vdots}{\cdots+\dfrac{x}{1+x}}}}}$。 用递归函数求解。 ## Input 第一个数是 $x$ 的值,第二个数是 $n$ 的值。($x$ 为**实数**,$n$ 为整数) ## Output 函数值,保留两位小数。 [samples]
Samples
Input #1
1
2
Output #1
0.40
API Response (JSON)
{
  "problem": {
    "name": "再求 f(x,n)",
    "description": {
      "content": "已知 $f(x,n)=\\dfrac{x}{n+\\dfrac{x}{(n-1)+\\dfrac{x}{(n-2)+\\dfrac{\\vdots}{\\cdots+\\dfrac{x}{1+x}}}}}$。 用递归函数求解。",
      "description_type": "Markdown"
    },
    "platform": "Luogu",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 131072
    },
    "difficulty": {
      "LuoguStyle": "P1"
    },
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "LGB2148"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "已知\n\n$f(x,n)=\\dfrac{x}{n+\\dfrac{x}{(n-1)+\\dfrac{x}{(n-2)+\\dfrac{\\vdots}{\\cdots+\\dfrac{x}{1+x}}}}}$。\n\n用递归函数求解。\n\n## Input\n\n第一个数是 $x$ 的值,第二个数是 $n$ 的值。($x$ 为**实数**,$n$ 为整数)\n\n## Output\n\n函数值,保留两位小数。\n\n[sample...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments