第k个幸运数
//大神看看,这样可以不 #include <string> using namespace std; int main() { int num = 16; while (cin>>num) { num--; string str; int n = log(num / 2 + 1)/log(2); int m=num-(1<<(n+1))+2; for (int i = 0; i <= n; i++) { str += (m & 1) ? "7" : "4"; m >>= 1; } reverse(str.begin(), str.end()); cout << str << endl; } return 0; }