首页
DreamJudge
院校信息
专业题库
模拟考试
机试真题
上岸课程
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
猪蹄子全是肉
2023年5月2日 14:03
01序列 题解:
P1001
回复 1
|
赞 6
|
浏览 2.7k
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main(){ // 遍历 0 ~ 63 这 64 个整数 for(int i=0;i<=63;i++){ // 对于每个整数 i ,遍历其二进制表示中的 6 位(因为 2^6=64) for(int j=5; j>=0; j--){ // 取出整数 i 的第 j 位二进制数...
HarryRookie
2023年11月2日 22:50
01序列 题解:
P1001
回复 1
|
赞 2
|
浏览 1.5k
评论区基本都是C/C++,这里给出一个Java的代码。 public class Main{ public static void main(String[] args){ for(int i=0;i<64;i++) System.out.println(Integer.toBinaryString(i+0b1000000).substring(1)); } } Integer.toBinaryString()方法返回的是没有前置零的二进制字符串,比如Integer.toBinaryString(4)...
Hhhhhq
2020年7月24日 11:01
(直接bitset格式化输出一行解决
P1001
回复 5
|
赞 7
|
浏览 14.2k
就是个输出0-64的二进制,直接调bitset一行解决(他不香嘛 #include<cstdio> #include<iostream> #include<bitset> using namespace std; int main(){ for(int i=0;i<64;i++){ cout<<bitset<6>(i)<<endl; } }...
天妒英才
2023年7月6日 21:50
01序列 题解:
P1001
回复 0
|
赞 1
|
浏览 1.3k
记录以下学习使用<bitset> #include <iostream> #include<bitset> using namespace std; int main() { int a=0; for(a=0;a<64;a++){ cout<<bitset<6>(a)<<endl; } } 其余常用函数: 构造函数:可以使用...
Hegel
2023年3月18日 15:20
输出所有5位二进制数
P1001
回复 0
|
赞 2
|
浏览 2.8k
#include <iostream> using namespace std; int main(){ int a[6] = {0,0,0,0,0,0}; for(int i =0;i<64;i++){ for(int j =0;j<6;j++) cout<<a[j]; cout<<endl; a[5]++; int k =5; while(a[k]==2){ a[k]=0; k--; a[k]++; } } }
huangdashuaige
2023年2月15日 21:24
P1001题解
P1001
回复 0
|
赞 2
|
浏览 3.8k
#include <iostream> using namespace std; int main( ) { //暴力解,6位数分别是0和1,进行6个for,并做流式输出 for(int a1=0;a1<=1;a1++) for(int a2=0;a2<=1;a2++) for(int a3=0;a...
max39
2022年5月12日 23:50
dfs 全排列思想 & 二进制化 两种解法
P1001
回复 2
|
赞 2
|
浏览 7.5k
#include <cstdio> using namespace std; int P[6]; void dfs(int index) { if (index == 6) { for (int i = 0; i <= 5; i++) { printf("%d", P[i]); } printf("\n"); return; } for (int i = 0; i <= 1; i++) { ...
蒋黎明
2022年3月15日 18:27
十进制转二进制
P1001
回复 0
|
赞 2
|
浏览 7.4k
#include<iostream> #include<string> #include<algorithm>> using namespace std; string get(int n){ string s = ""; while(n != 0){ int i = n%2; char c = i + '0'; &nb...
dengfenglai
2021年1月28日 21:47
人生苦短,我用Python
P1001
回复 1
|
赞 2
|
浏览 11.1k
for i in range(64): print("{0:06b}".format(i))
crazypig
2021年4月6日 17:28
堆的思想
P1001
回复 0
|
赞 0
|
浏览 9.6k
堆的遍历,构造一个完全二叉树,遍历堆。 def travel(x, deep, res): if deep == 6: print("".join(res)) return res[:-1] res.append(x[2*deep+1]) res = travel(x, deep+1, res) res.append(x[2*deep+2]) res = travel(x, deep+1, res) return res[:-1] if __name__...
1
2
3
4
5
题目
01序列
题解数量
43
发布题解
在线答疑
热门题解
1
01序列 题解:C
2
01序列 题解:使用一个while+一个01存储数组
3
01序列 题解:输出0-63的六位二进制即可
4
P1001 - 01 序列 - C
5
01序列 题解:bitset()函数,秒杀!
6
(直接bitset格式化输出一行解决
7
我这思路适合0基础,数学思维。
8
01序列 题解:
9
01序列 题解:自动+bitset<6>
10
01序列 (二进制枚举)题解: