{
  "type": "code_options",
  "author": "csdn.net",
  "source": "solution.md",
  "exercise_id": "ce9c2b5715b9442288e0e56552087acf",
  "keywords": "数列,数学运算",
  "title": "求数列第n项值",
  "desc": [
    {
      "content": "\n<p>求数列第n项值&#xff1a;1,2,3,6,11,20,37,68,125,230,.....例如:第7项为37&#xff0c;第9项为125。</p>",
      "language": "markdown"
    }
  ],
  "answer": [
    {
      "content": "",
      "language": "cpp"
    }
  ],
  "prepared": [
    [
      {
        "content": "",
        "language": "cpp"
      }
    ],
    [
      {
        "content": "",
        "language": "cpp"
      }
    ],
    [
      {
        "content": "",
        "language": "cpp"
      }
    ]
  ],
  "template": {
    "content": "#include <stdio.h>\nint main(void) { \n\tint n;\n\tprintf(\"请输入n的值：\");\n\tscanf(\"%d\",&n);\n\tif(n==1){\n\t\tprintf(\"第1项为1\\n\");\n\t}else if(n==2){\n\t\tprintf(\"第2项为2\\n\");\n\t}else if(n==3){\n\t\tprintf(\"第3项为3\\n\");\n\t}else{\n\t\tint f1=1,f2=2,f3=3;\n\t\tint i,fn;\n\t\tfor(i=4;i<=n;i++){\n\t\t\tfn=f1+f2+f3;\n\t\t\tf1=f2;\n\t\t\tf2=f3;\n\t\t\tf3=fn;\n\t\t}\n\t\tprintf(\"第%d项为%d\\n\",n,fn);\n\t}\n\treturn 0;\n}",
    "language": "cpp"
  },
  "node_id": "dailycode-9662f082ecb24eafbabd9cc73d7a5847",
  "license": "csdn.net",
  "created_at": 1637894160,
  "topic_link": "https://bbs.csdn.net/topics/600469855"
}