首页
DreamJudge
院校信息
考研初试
考研复试
保研专区
讨论区
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
New_chapter
2026年2月24日 14:00
二进制数 题解:
P1380
回复 0
|
赞 2
|
浏览 78
#include<iostream> using namespace std; #include<string> int main(){ int num; string ant; cin>>num; if(num == 0) { cout << "0"; return 0; } while(num...
xsw
2026年2月1日 10:13
二进制数 题解:
P1380
回复 0
|
赞 4
|
浏览 190
#include<iostream> #include<algorithm> #include<vector> using namespace std; void change(int x) { vector<int> q; while (x) { q.push_back(x % 2); x /= 2; } reverse(q.begin(),q.end()); for (auto c : q) cout << c; cout << endl; } in...
mlx
2026年1月29日 21:30
二进制数 题解:
P1380
回复 0
|
赞 1
|
浏览 138
#include<iostream> #include<algorithm> #include<vector> using namespace std; int n; vector<int> num; int main() { cin>>n; while(n) { num.push_back(n%2); n/=2; } reverse(num.begin(),num.end()); for(int i=0;i<num.size();i++) cout<...
曾不会
2026年1月24日 10:50
二进制数 题解:
P1380
回复 0
|
赞 4
|
浏览 129
#include<stdio.h> #include<string.h> int main() { int n; scanf("%d",&n); int s[100]; int i=0; while(n!=0) { s...
bro
2026年1月21日 15:38
二进制数 题解:c++
P1380
回复 0
|
赞 0
|
浏览 140
#include<bits/stdc++.h> using namespace std; int main(){ int n; while(cin >> n){ int num[20]; int index = 0; while(n){ nu...
无名1
2025年6月25日 20:27
二进制数 题解:C++
P1380
回复 0
|
赞 5
|
浏览 1.1k
#include<bits/stdc++.h> using namespace std; int main(){ unsigned int n; while(cin>>n){ int num[100],index=0; while(n!=0){ num[index]=n%2; n=n/2; index++; } for(int i=index-1;i>=0;i--){ cout<<num[i]; } cout<<endl; } return...
阿灿
2025年3月18日 18:56
二进制数 题解:log一下就好了
P1380
回复 0
|
赞 3
|
浏览 2.0k
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; // 计算需要的二进制位数 int bits = n == 0 ? 1 : static_cast<int>(log2(n)) + 1; cout << bitset<32>(n).to_string().substr(32 - bits) << endl; return 0; } ...
zxjrheaven
2025年3月9日 15:49
二进制数 题解:暴力至高
P1380
回复 0
|
赞 9
|
浏览 1.6k
#include <bits/stdc++.h> using namespace std; int num[32]={0}; int main() { unsigned int n; while(cin>>n) { int a=n; int j=-1;  ...
jaygee_
2025年3月6日 23:37
二进制数 题解:
P1380
回复 0
|
赞 6
|
浏览 1.1k
使用string库函数 #include<bits/stdc++.h> using namespace std; int a[105]; int main() { int n; string s; while(cin >> n) { int cnt = 0; if(n == 0) { cout << '0' << endl; continue; } while(n > 0) { int num = n % 2; a[cnt ++] = num; ...
chenxx
2025年2月26日 18:58
二进制数 题解:
P1380
回复 0
|
赞 12
|
浏览 1.3k
#include<bits/stdc++.h> using namespace std; int main(){ int n; cin>>n; string ans; while(n){ ans += to_string(n%2); ...
1
2
3
题目
二进制数
题解数量
27
发布题解
在线答疑
热门题解
1
二进制数 题解:
2
二进制数 题解:
3
二进制数 题解:暴力至高
4
二进制数 题解:递归解决
5
二进制数 题解:
6
二进制数 题解:C++
7
常规进制转换
8
二进制数 题解:
9
二进制数 题解:
10
二进制数 题解:<vector>容器解法