옵션 |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | #include <iostream> #include <set> using namespace std; bool repeatless(unsigned int number) { set<int> sNumber; bool how = true; if (number < 10) return true; else { while (number != 0) { how = sNumber.insert(number % 10).second; if (how == false) return false; number /= 10; } return true; } } int main() { unsigned int number = -1; while (number) { cin >> number; unsigned int i = 0; for (unsigned int j = 1; j <= number;j++) { i++; if (repeatless(i) != true) j--; //else // cout << i<<" "; } if(number != 0) cout << i << endl; } } | cs |