#include #include #include #include #include using namespace std; bool is_kadomatsu_digit(long long x){ bool ok = true; stringstream ss; ss << x; string s; ss >> s; if(s.size()<=2) return false; int a = s[0] - '0'; int b = s[1] - '0'; for(int i=2; ib && bc && a!=c)) ) return false; a = b; b = c; } return true; } int main_(){ int n; cin >> n; for(int i=100; n; i++){ if(is_kadomatsu_digit(i)){ n--;//s.insert(i); } if(n==0) cout << i << endl; } return 0; } #include int main(){ //auto s = clock(); int t; cin >> t; while(t--){ main_(); } //cerr << clock()-s << endl; return 0; }