题解 F| #怎么写线性SPJ#

代码实现

#include <iostream>
using namespace std;

int n;

int main() {
    cin >> n;  
    int k;
    string s = "1";  
    int i = 2;  

   
    while (s.size() < n) {
        char c = '0' + i; 
        s = s + c + s;  
        i += 1; 
    }

    cout << i - 1 << "\n"; 
  
    for (int i = 0; i < n; i++) {
        cout << s[i] - '0' << " ";  //比赛的时候没写-'0',10变成符号直接g啊
    }

    return 0;
}