求 f(x,n)

Luogu
IDLGB2147
Time1000ms
Memory128MB
DifficultyP1
函数与递归
已知 $f(x,n)=\sqrt{n+\sqrt{(n-1)+\sqrt{(n-2)+\sqrt{...+2+\sqrt{1+x}}}}}$。 计算 $f(x,n)$ 的值。 ## Input 输入 $x$ 和 $n$。 ## Output 函数值,保留两位小数。 [samples] ## Note #### 数据范围 对于 $100\%$ 的数据,$1 \le x,n \le 10$。
Samples
Input #1
4.2 10
Output #1
3.68
API Response (JSON)
{
  "problem": {
    "name": "求 f(x,n)",
    "description": {
      "content": "已知 $f(x,n)=\\sqrt{n+\\sqrt{(n-1)+\\sqrt{(n-2)+\\sqrt{...+2+\\sqrt{1+x}}}}}$。 计算 $f(x,n)$ 的值。",
      "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": "LGB2147"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "已知 $f(x,n)=\\sqrt{n+\\sqrt{(n-1)+\\sqrt{(n-2)+\\sqrt{...+2+\\sqrt{1+x}}}}}$。\n\n计算 $f(x,n)$ 的值。\n\n## Input\n\n输入 $x$ 和 $n$。\n\n## Output\n\n函数值,保留两位小数。\n\n[samples]\n\n## Note\n\n#### 数据范围\n\n对于 $100\\%$ 的数据,$1 \\le x,n \\le ...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments