一个基于C++内置bitset的解法 摘要:对于这道题,首先如果读者C++的知识基础比较好,那么我们可以知道C++有个bitset可以直接将对应的十进制整数转为二进制并限定位数。由于题目中整数范围为2的16次方,故可设位数为17位,即bitse…… 题解列表 2026年01月22日 0 点赞 0 评论 0 浏览 评分:0.0
十->二进制转换(数组 模拟) 摘要:解题思路:模拟注意事项:参考代码:#include<iostream>#include<cmath>#include<cstring>using&nbs…… 题解列表 2025年02月02日 0 点赞 0 评论 357 浏览 评分:0.0
旧物有情 # 字符串翻转求解二进制转换 摘要:``` #include #include using namespace std; int main(){ int n; while(cin >> n){ …… 题解列表 2024年10月10日 0 点赞 0 评论 298 浏览 评分:0.0
1192: 十->二进制转换 摘要:```cpp #include #include using namespace std; //进制转换并输出函数不考虑特殊情况 void transport(int x) { …… 题解列表 2024年10月03日 0 点赞 0 评论 349 浏览 评分:9.9
位运算是个简便方法 摘要:参考代码:#include<bits/stdc++.h> using namespace std; int wei(int n) { int cnt=0; while(n!=0) {…… 题解列表 2024年09月17日 0 点赞 0 评论 314 浏览 评分:0.0
使用java自带函数Integer.toBinaryString(n),将n转成二进制字符串返回 摘要:解题思路:注意事项:参考代码:import java.util.Scanner; public class Main { public static void main(String[…… 题解列表 2024年03月21日 0 点赞 0 评论 321 浏览 评分:0.0
十->二进制转换 摘要: 有点复杂哈,主要是格式问题 #include int main() { int n; while((scanf("%d",&n))!=E…… 题解列表 2024年03月20日 0 点赞 0 评论 390 浏览 评分:9.9
c代码记录之二进制转换(无二进制输出格式,长除法将十进制转换成二进制) 摘要: #include int main() { int num[32],n,i,m,j; while(~scanf("%d",&n)){ …… 题解列表 2023年12月13日 0 点赞 0 评论 379 浏览 评分:0.0
优质题解 1192: 十->二进制转换(位运算做法) 摘要:解题思路:看了一些题解,都是将数字转成二进制放入数组中,或者栈里面,我认为这道题用位运算来做是最简洁最舒服的,也不用开辟额外数组。我们知道,数字在计算机的内部都是使用二进制进行存储的,严格来说,存储的…… 题解列表 2023年11月18日 0 点赞 0 评论 915 浏览 评分:9.9
用栈解决这个问题 摘要:解题思路:注意事项:参考代码:#include<stdio.h>#include<stdlib.h>#include<math.h>#define maxsize 101typedef struct{…… 题解列表 2023年10月08日 0 点赞 0 评论 518 浏览 评分:0.0