标签:clu its 技术 inf span out count http nbsp
#include<iostream> #include<string> using namespace std; uint32_t reverseBits(uint32_t n) { uint32_t a = 0; int count = 0; string s = ""; while (n) { s += to_string(n%2); n = n / 2; } for (int i = 0; i < s.length(); i++) { a = a * 2 + int(s[i] - ‘0‘); } count = 32 - s.length(); while (count) { a = a * 2; count -= 1; } return a; } int main() { uint32_t a = 4294967293; cout << reverseBits(a) << endl; return 0; }
标签:clu its 技术 inf span out count http nbsp
原文地址:https://www.cnblogs.com/luo-c/p/12864737.html