A1001. 01序列
时间限制:
1.0s 内存限制:
256.0MB
问题描述
对于长度为6位的一个01串,每一位都可能是0或1,一共有64种可能。它的前几个是:
000000
000001
000010
000011
000100
请按从小到大的顺序输出这64种01串。
000000
000001
000010
000011
000100
请按从小到大的顺序输出这64种01串。
输出格式
输出64行,每行一个01串。
- #include <stdio.h>
- //#include <windows.h>
- #include <iostream>
- using namespace std;
- int main(){
- int i;
- char x[6];
- for(i=0;i<64;i++)
- {
- //printf("%d\n",i+1);
- itoa(i,x,2);
- printf("%06s\n",x);
- }
- // system("pasue");
- getchar();
- return 0;
- }