蓝桥杯BASIC-2——基础练习 01字串
来源:互联网 发布:淘宝卖家哪个商品好用 编辑:程序博客网 时间:2024/05/22 17:02
基础练习 01字串
时间限制:1.0s 内存限制:256.0MB
问题描述
对于长度为5位的一个01串,每一位都可能是0或1,一共有32种可能。它们的前几个是:
00000
00001
00010
00011
00100
请按从小到大的顺序输出这32种01串。
输入格式
本试题没有输入。
输出格式
输出32行,按从小到大的顺序每行一个长度为5的01串。
样例输出
00000
00001
00010
00011
00001
00010
00011
<以下部分省略>
/** * * @author hhit.soft141.xxf * @date 2017-1-31 * */public class Main {/** * @param args */public static void main(String[] args) {for (int i = 0; i < 32; i++) {String binaryString = Integer.toBinaryString(i);if (binaryString.length() < 5) {for (int j = 0; j < 5 - binaryString.length(); j++) {System.out.print("0");}System.out.println(binaryString);} else {System.out.println(binaryString);}}}}
1 0
- 蓝桥杯-基础练习之01字串——BASIC-2
- 蓝桥杯BASIC-2——基础练习 01字串
- 蓝桥杯 BASIC-2 基础练习 01字串
- 蓝桥杯基础练习BASIC-2 01字串
- 蓝桥杯 BASIC-2 基础练习 01字串
- 基础练习 BASIC-2 01字串
- BASIC-2 基础练习 01字串
- 蓝桥杯:基础练习 01字串
- 蓝桥杯 【基础练习】 01字串
- “蓝桥杯”基础练习:01字串
- 蓝桥杯基础练习--01字串
- 蓝桥杯基础练习:01字串
- 蓝桥杯 基础练习 01字串
- 蓝桥杯--基础练习 01字串
- 蓝桥杯基础练习 01字串
- 蓝桥杯-基础练习-01字串
- 蓝桥杯 基础练习 01字串
- 蓝桥杯--基础练习--01字串
- Graphics_Work笔记
- bind函数源码解析
- MySQL数据类型
- 史上最简单的UIScrollView+Autolayout出坑指南
- 从运维角度浅谈MySQL数据库优化
- 蓝桥杯BASIC-2——基础练习 01字串
- 双均线策略
- 二分归并排序之求逆序数
- recycleview
- Nginx+Tomcat搭建高性能负载均衡集群
- 冷屏是什么?
- 计算机与艺术千丝万缕的联系
- Android Studio 安装
- 373. Find K Pairs with Smallest Sums