solution.json 1.8 KB
Newer Older
每日一练社区's avatar
每日一练社区 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
{
  "type": "code_options",
  "author": "csdn.net",
  "source": "solution.md",
  "exercise_id": "462fb7f7f607424488dab204267caa1d",
  "keywords": "算法高阶,数论算法,算法问题选编,整数的因子分解",
  "title": "1,3,3,5,5,5,7,7,7,7,9,9,9,9,9,.....",
  "desc": [
    {
      "content": "\n<p><a href=\"http://114.67.86.56:5000/Problem_Show.asp?id&#61;1045\">简单数列5</a><br />\n<strong> </strong>已知一数列&#xff1a;1,3,3,5,5,5,7,7,7,7,9,9,9,9,9,11,11,11,11,11,11,11.....请根据规律求出第n项的值。例如&#xff1a;n&#61;4 项时&#xff0c;其值为5,n&#61;11时&#xff0c;其值为9.\n<strong>输入格式 </strong>一个自然数n,(0&lt;n&lt;1000)<br />\n<br />\n<strong>输出格式</strong> 一个整数&#xff0c;即第n项的值。<br />\n<strong>样例输入&#xff1a;4</strong><br />\n<strong>样例输出 &#xff1a;5</strong></p>",
      "language": "markdown"
    }
  ],
  "answer": [
    {
      "content": "",
      "language": "cpp"
    }
  ],
  "prepared": [
    [
      {
        "content": "",
        "language": "cpp"
      }
    ],
    [
      {
        "content": "",
        "language": "cpp"
      }
    ],
    [
      {
        "content": "",
        "language": "cpp"
      }
    ]
  ],
  "template": {
    "content": "#include <iostream>\nusing namespace std;\nint main(){\n\tint a,b;\n\tcin>>a;\n\tint n=1,count=1,num=1;\n\tfor(int i=0;i<a;i++)\n\t{\n\t\tif(count > n)\n\t\t{\n\t\t\tnum+=2;\n\t\t\tn++;\n\t\t\tcount=1;\n\t\t\ti--;\n\t\t}\n\t\telse\n\t\t{\n\t\tcout << num << \",\";\t\n\t\tcount++;\n\t\t}\n\t}\n\tcout << endl;\n\tcout << num;\n\treturn 0;\n}",
    "language": "cpp"
  },
  "node_id": "dailycode-a3c6d1ba3eff44589c32c36ce4d9d666",
  "license": "csdn.net",
  "created_at": 1637894160,
  "topic_link": "https://bbs.csdn.net/topics/600470254"
}