学***佬,请问还有什么题吗,方便透露一下,练练手,感谢~ #include <iostream> using namespace std; int main() {     int n;     cin>>n;     int num = 0;     for(int i = 0;i <= n;i++)     {         for(int j = i;j > 0;j>>=1)         {             int temp1 = j & 1;             j>>=1;             cout<<j<<":"<<temp1<<endl;             int temp2 = j & 1;             j>>=1;             cout<<j<<":"<<temp2<<endl;             int temp3 = j & 1;             cout<<j<<":"<<temp3<<endl;             if(temp1 == 1 && temp2 == 1 && temp3 == 1)             {                 num++;             }         }     }     cout<<num;     return 0; }
点赞 评论

相关推荐

不愿透露姓名的神秘牛友
07-01 11:27
点赞 评论 收藏
分享
06-19 19:06
门头沟学院 Java
码农索隆:别去东软,真学不到东西,真事
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务