{
  "type": "code_options",
  "author": "csdn.net",
  "source": "solution.md",
  "exercise_id": "470a59d0ed744d55b36a9fbe8ed76198",
  "keywords": "数列",
  "title": "怎么求尾数与常数之和？",
  "desc": [
    {
      "content": "\n<p>数列的前3项都为1&#xff0c;从第4项开始&#xff0c;每项都是其前3项的和&#xff1a;1, 1, 1, 3, 5, 9, 17, … 请你编程求出数列第N项的<strong>4位尾数</strong>与90000之和。输入一个正整数N&#xff0c;输出所求的和。</p>",
      "language": "markdown"
    }
  ],
  "answer": [
    {
      "content": "",
      "language": "cpp"
    }
  ],
  "prepared": [
    [
      {
        "content": "",
        "language": "cpp"
      }
    ],
    [
      {
        "content": "",
        "language": "cpp"
      }
    ],
    [
      {
        "content": "",
        "language": "cpp"
      }
    ]
  ],
  "template": {
    "content": "#include <iostream>\n#include <cstring>\n#include <cstdio>\n#include <cstdlib>\n#include <cmath>\n#include <iomanip>\n#include <algorithm>\n#include <set>\nusing namespace std;\n#define NUM 10000\nlong long dp[1000000];\nint main(){\n    int n;\n    cin>>n;\n    dp[1]=1;\n    dp[2]=1;\n    dp[3]=1;\n    for(int i=4;i<=n;i++){\n        dp[i]=dp[i-1]+dp[i-2]+dp[i-3];\n    }\n    cout<<dp[n]<<endl;\n    long long x=dp[n]%NUM+90000;\n    cout<<x;\n    system(\"pause\");\n    return 0;\n}",
    "language": "cpp"
  },
  "node_id": "dailycode-0d0995dc614d484ca466036511232672",
  "license": "csdn.net",
  "created_at": 1637894160,
  "topic_link": "https://bbs.csdn.net/topics/600470143"
}