{ "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

简单数列5
\n 已知一数列:1,3,3,5,5,5,7,7,7,7,9,9,9,9,9,11,11,11,11,11,11,11.....请根据规律求出第n项的值。例如:n=4 项时,其值为5,n=11时,其值为9.\n输入格式 一个自然数n,(0<n<1000)
\n
\n输出格式 一个整数,即第n项的值。
\n样例输入:4
\n样例输出 :5

", "language": "markdown" } ], "answer": [ { "content": "", "language": "cpp" } ], "prepared": [ [ { "content": "", "language": "cpp" } ], [ { "content": "", "language": "cpp" } ], [ { "content": "", "language": "cpp" } ] ], "template": { "content": "#include \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 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" }