题解 | #小红的字符生成#
小红的字符生成
https://www.nowcoder.com/practice/f8659377ca104b1aad45dd2fb564c940
真是优美的二进制啊 ヾ(•ω•`)o
#include <iostream> using namespace std; int main() { int n; cin>>n; int pos=0; while(n!=0) { if((n&1)==1) { cout<<(char)('a'+pos); } pos++; n = n>>1; } } // 64 位输出请用 printf("%lld")