首页
DreamJudge
院校信息
考研初试
考研复试
保研专区
讨论区
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
928上岸梦校!
2023年8月5日 10:48
常规进制转换
P1380
回复 0
|
赞 4
|
浏览 1.9k
使用STL容器vector存储二进制串 #include <bits/stdc++.h> using namespace std; int main() { int n; while (cin >> n) { vector<int> bin; while (n != 0) { int remainder = n % 2; bin.push_back(remainder); ...
Hegel
2023年3月18日 16:35
十进制转二进制
P1380
回复 0
|
赞 1
|
浏览 2.8k
#include <iostream> using namespace std; int main() { unsigned int a; while (cin >> a) { string res = ""; while (a > 0) { char t = a % 2 + '0'; res = t + res; a /= 2; } cout << res << endl; } return 0; }
落翼
2023年1月21日 15:20
python求解
P1380
回复 0
|
赞 0
|
浏览 4.4k
使用bin函数可轻松求解: while True: try: a = input() a = bin(int(a)) print(a[2:]) except: break
LianG_nnuo
2022年11月11日 21:49
c 二进制数
P1380
回复 0
|
赞 3
|
浏览 5.3k
#include<stdio.h> #include<stdlib.h> #include<string.h> #include<math.h> #include<time.h> /* 大家都知道,数据在计算机里中存储是以二进制的形式存储的。 有一天,小明学了C语言之后,他想知道一个类型为unsigned int 类型的数字, 存储在计算机中的二进制串是什么样子的。 你能帮帮小明吗? 并且,小明不想要二进制串中前面的没有意义的0串,即要去掉前导0。 复制 23 输出样例#: 复制 10111 ...
kas
2022年3月16日 20:29
二进制数
P1380
回复 0
|
赞 2
|
浏览 5.6k
#include<iostream> using namespace std; int main() { long int n; cin >> n; string ans = ""; while(n){ ans = to_string(n % 2) + ans; &...
toxible
2020年5月6日 15:46
思路比较直
P1380
回复 0
|
赞 2
|
浏览 11.2k
#include<stdio.h> int main(){ int a,b,pos; while(scanf("%d",&a)!=EOF){ pos=1,b=0; while(a!=0){ if(a%2==1) b+=pos; pos*=10; a/=2; } printf("%d\n",b); } return 0; }
maomaonihao
2020年3月11日 18:28
二进制数
P1380
回复 0
|
赞 2
|
浏览 11.1k
#include <iostream> using namespace std; int main() { long long n; int s[105]; cin>>n; int cnt=0; while(n>0){//将n逐位分解 int w=(n%2);  ...
1
2
3
题目
二进制数
题解数量
27
发布题解
在线答疑
热门题解
1
二进制数 题解:
2
二进制数 题解:
3
二进制数 题解:暴力至高
4
二进制数 题解:递归解决
5
二进制数 题解:
6
二进制数 题解:C++
7
常规进制转换
8
二进制数 题解:
9
二进制数 题解:
10
二进制数 题解:<vector>容器解法