> 技术文档 > 【刷题】东方博宜oj 1307 - 数的计数

【刷题】东方博宜oj 1307 - 数的计数

【刷题】东方博宜oj 1307 - 数的计数【刷题】东方博宜oj 1307 - 数的计数
样例输入:

6

输出:

162612636136

原版是直接输出总数量,但我修改了一些,输出所有的新数。

#include #include #include using namespace std;//int c;void g(int num, string current, vector<string>& result) { for (int i = 1; i <= num / 2; ++i) { string newNum = to_string(i) + current; result.push_back(newNum); //c++; g(i, newNum, result); }}int main() { int n; cin >> n; vector<string> result; g(n, to_string(n), result); for (string s : result) { cout << s << endl; } return 0;}