https://www.acmicpc.net/problem/25180

팰린드롬을 만들 때 가장 큰 숫자 9를 최대한 활용하면 자릿수를 최소화할 수 있다.
9를 한 번씩 추가하면(총 2자리 추가) 자리 합이 만큼 올라감.9를 붙여준다.
나머지 에 따라 추가 자리 수를 더함
최종 답은
#include <iostream>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
int N;
cin >> N;
int ans = (N / 18) * 2;
if(N % 18 == 0) cout << ans;
else if(N % 18 <= 9) cout << ans + 1;
else if((N % 18) % 2 == 0) cout << ans + 2;
else cout << ans + 3;
return 0;
}