主站
DreamJudge
院校信息
专业题库
模拟考试
机试真题
专业课程
讨论区
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
damowanghwj
2024年3月24日 17:22
01序列 题解:输出0-63的六位二进制即可
P1001
回复 0
|
赞 0
|
浏览 94
#include<bits/stdc++.h> using namespace std; string trans(int n){ string s = ""; for(int i = 0; i < 6;i++){ if(n > 0){ int w = n % 2; s += w + '0'; n = n/2; } else s += "0"; ...
zwl__rank
2024年3月23日 18:53
01序列 题解:
P1001
回复 0
|
赞 0
|
浏览 85
法1:暴力直接六层for循环,不多bb #include<iostream> using namespace std; int main() { int a,b,c,d,e,f; for(a=0;a<2;++a) for(b=0;b<2;++b) for(c=0;c<2;++c) &nbs...
lingdongyang
2024年3月17日 16:38
01序列 题解:
P1001
回复 0
|
赞 1
|
浏览 197
#include<stdio.h> int main() { for (int i = 0; i <= 63; i++) { int n = i;//把i变成轮次,n来进行求二进制 int cnt = 0;//个数 char s[6] = { 0 }; while (n) { s[cnt++] = n % 2;//先用cnt再加加 n = n / 2; } for (int j = 5; j >= 0; j--) { printf("%d", s[j]); } prin...
小酒
2024年3月11日 15:51
01序列 题解:
P1001
回复 3
|
赞 0
|
浏览 279
1001解题思路 #include <bits/stdc++.h> using namespace std; int main() { int i; for(i=0;i<64;i++) { int a[105]={0}; int m=i; &n...
FCC
2024年3月14日 22:28
01序列 题解:移位+与
P1001
回复 0
|
赞 0
|
浏览 137
#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) 内层循环从5到0,因为输出顺序是从高位到低位,而二进制是从低位到高位的,因此需要从高位开始循环。*/ for(int j=...
orderrr
2024年3月11日 17:39
01序列 题解:c语言求解
P1001
回复 0
|
赞 0
|
浏览 181
#include <stdio.h> #include <string.h> char s[6]; void reverse(char s[]) //翻转字符数组 { for (int i = 0; i < strlen(s) / 2; i++) { char temp = s[i]; s[i] = s[strlen(s) - i - 1]; s[strlen(s) - i - 1] = temp; } } char *toTow(int x) { ...
yczhou
2024年3月10日 21:08
01序列 题解:
P1001
回复 0
|
赞 0
|
浏览 170
#include<stdio.h> #include<math.h> int DexToBin(int n){ int a[10],cnt=0,m=0; while (n>0){//将十进制转换为二进制存储在数组中 a[cnt++]=n%2; n=n/2; } for(int i=cnt-1;i>=0;i--){//将数组中顺序颠倒的二进制数转正 m+=pow(10,i)*a[i]; } return m; } int main...
0.0@86977
2024年2月12日 17:19
利用进制转换,输出0-63的二进制
P1001
回复 0
|
赞 1
|
浏览 485
#include<bits/stdc++.h> using namespace std; int erjin(int a){ int t[6]={0}; int k=0; while(a!=0){ t[k++]=a%2; a/=2; } &nb...
猪蹄子全是肉
2023年5月2日 14:03
01序列 题解:
P1001
回复 1
|
赞 5
|
浏览 1.2k
#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
|
赞 1
|
浏览 638
评论区基本都是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)...
1
2
3
4
题目
01序列
题解数量
31
发布题解
热门题解
1
P1001 - 01 序列 - C
2
我这思路适合0基础,数学思维。
3
(直接bitset格式化输出一行解决
4
01序列 题解:
5
看到题解全是一圈妖魔鬼怪,就真的忍不住了
6
dfs 全排列思想 & 二进制化 两种解法
7
输出所有5位二进制数
8
人生苦短,我用Python
9
P1001题解
10
十进制转二进制