蓝桥杯 01字串问题
实质是输出0-31的五位二进制表示形式
可参考2016年第五题,二进制输出有固定的形式,可套用
#include<iostream>
using namespace std;
int main(){
for(int x=0;x<32;x++){
for(int i=0;i<5;i++){
cout<<((x>>4-i)&1);
}
cout<<endl;
}
}
蓝桥杯 01字串问题
实质是输出0-31的五位二进制表示形式
可参考2016年第五题,二进制输出有固定的形式,可套用
#include<iostream>
using namespace std;
int main(){
for(int x=0;x<32;x++){
for(int i=0;i<5;i++){
cout<<((x>>4-i)&1);
}
cout<<endl;
}
}