01序列01序列

文章目录


一、题目描述

cpp 复制代码
题目描述
Time Limit: 1000 ms
Memory Limit: 256 mb
对于长度为6位的一个01串,每一位都可能是0或1,一共有64种可能。它的前几个是:
000000
000001
000010
000011
000100
请按从小到大的顺序输出这64种01串。

输入输出格式
输入描述:
输出描述:
输出64行,每行一个01串。
输入输出样例
输入样例#:
输出样例#:

二、参考代码

cpp 复制代码
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
using namespace std;



int main()
{
    for (int a = 0; a <= 1; a++)
        for (int b = 0; b <= 1; b++)
            for (int c = 0; c <= 1; c++)
                for (int d = 0; d <= 1; d++)
                    for (int e = 0; e <= 1; e++)
                        for (int f = 0; f <= 1; f++)
                            cout << a << b << c << d << e << f << endl;
    return 0;
}

相关推荐
大可不必了10 小时前
03 函数定义和调用
开发语言·python
I_belong_to_jesus10 小时前
C++关于分支预测的优化1
开发语言·c++·算法
承渊政道11 小时前
【Python编程—从入门到实践】(记分与闯关:用Python+Pygame,打造越战越精彩的太空大战!)
开发语言·python·pycharm·游戏程序·pygame
爱学习的程序媛11 小时前
Python常用框架梳理
开发语言·后端·python·ai·web·后端框架·python框架
Rabitebla11 小时前
【Linux】进程控制(十二) 自定义 Shell(二):内建命令与进程工作目录管理
linux·c++·笔记·学习·bash
eggwyw12 小时前
Anaconda安装卸载的详细流程指南
开发语言·python
码客-ygluu17 小时前
一个通用游戏数据服务器
c++·架构
another heaven17 小时前
【C/C++ Ranges 是零开销抽象吗?拆开管道、惰性求值和编译期膨胀】
c语言·开发语言·c++
Code_Solitude17 小时前
C语言动态内存 + 柔性数组 + 数组名退化
c语言·算法·柔性数组