题解 1192: 十->二进制转换

来看看其他人写的题解吧!要先自己动手做才会有提高哦! 
返回题目 | 我来写题解

筛选

十->二进制转换

摘要:解题思路:注意事项:参考代码:#include<bits/stdc++.h>using namespace std;string decToBin(int n){    string ans;    ……

一个基于C++内置bitset的解法

对于这道题,首先如果读者C++的知识基础比较好,那么我们可以知道C++有个bitset可以直接将对应的十进制整数转为二进制并限定位数。由于题目中整数范围为2的16次方,故可设位数为17位,即bitset(),信誓旦旦地写上,啪的一片红QAQ。

位运算是个简便方法

摘要:参考代码:#include<bits/stdc++.h> using namespace std; int wei(int n) { int cnt=0; while(n!=0) {……

有注释 简单易懂 STL stack

```cpp#include#include#includeusingnamespacestd;stacks;intmain(){//stack先进后出intflag=0;//用来标记输入的n是否小于0,小于0的话就要输出"-"号intn;while(scanf("%d",

十进制转二进制

摘要:解题思路:注意事项:参考代码:#include<iostream>using namespace std;#include<stack>stack<char> s;int main(){    int……

十->二进制转换常规算法

摘要:解题思路:注意事项:参考代码:#include<bits/stdc++.h>using namespace std;int main(){int pa;while(cin>>pa){  //如何判断输……

十->二进制转换

```cpp#include#include#includetypedefstructSNode{longlongdata;structSNode*next;}SNode,*LinkStack;intInitSNode(LinkStack&S){S=(SNode*)malloc(sizeof(SNod