首页
DreamJudge
院校信息
考研初试
机试真题
讨论区
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
Cookie‘s AE86
2024年1月18日 09:22
八进制 题解:printf语句实现
P1417
回复 0
|
赞 0
|
浏览 917
#include<bits/stdc++.h> using namespace std; int main( ){ int s; while(cin >> s){ printf("%o\n",s); } }
Cookie‘s AE86
2024年1月17日 10:55
八进制 题解:C++实现
P1417
回复 0
|
赞 1
|
浏览 1.1k
#include<bits/stdc++.h> using namespace std; int main( ){ int s; while(cin >> s){ char ans[999999]; int cnt = 0; while(s != 0){ ans[cnt ++] = (s % 8) + '0'; s /= 8; } for(int i = cnt -1 ;i >= 0 ;...
928上岸梦校!
2023年8月5日 10:51
常规进制转换
P1417
回复 0
|
赞 1
|
浏览 899
使用STL容器vector存储八进制串 #include <bits/stdc++.h> using namespace std; int main() { int n; while (cin >> n) { vector<int> newbase; while (n != 0) { int remainder = n % 8; newbase.push_back(remainder); ...
我不是深井冰丶
2023年3月26日 12:09
一套十进制转n进制的模板
P1417
回复 0
|
赞 0
|
浏览 2.3k
#include <bits/stdc++.h> using namespace std; vector<string> radixArr = {"0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"}; // 进制转换 string radixConvert(int x,int d){ string str = ""; while(x!=0){ if(x%d >= 16){ return "null"; ...
Hegel
2023年3月21日 19:48
十进制转八进制
P1417
回复 0
|
赞 1
|
浏览 2.7k
#include <iostream> #include <string> using namespace std; int main() { int n; while(cin>>n){ string res=""; while(n>0){ res=char(n%8+'0')+res; n/=8; } cout<<res<<endl; } return 0; } 思路很简单,重要的是可以熟练写出并应用。
落翼
2023年1月21日 15:22
python求解
P1417
回复 0
|
赞 0
|
浏览 3.7k
使用oct函数可轻松求解: while True: try: a = int(input()) a = oct(a) print(a[2:]) except: break
Sacan
2022年6月2日 21:02
“除x取余,逆序排列”
P1417
回复 0
|
赞 2
|
浏览 4.4k
10进制转x进制,根据数学课上学过的“除x取余,逆序排列”,模拟这个过程就可以。 这里是8进制,x就为8; 当然,当x大于10后,就需要做一些char的变换,如余数10变成a或A。。。 #include <iostream> #include <vector> using namespace std; int main() { int n; while(cin >> n){ &nb...
Anylike
2020年5月24日 16:04
最短的实现
P1417
回复 0
|
赞 1
|
浏览 8.6k
由于题目数据没有特别要求,最快最短的实现方法就是直接%o输出 #include <bits/stdc++.h> using namespace std; int main() { int num; while(cin>>num) { printf("%o\n",num); } return 0; }
tgeuuy
2020年3月7日 17:38
八进制
P1417
回复 0
|
赞 0
|
浏览 9.1k
#include<iostream> using namespace std; int main() { int n, k, temp; int a[1000]; int T; cin>>T; while(T--) { cin>>n; ...
LIkkkkkkka
2020年3月7日 17:43
4u2
P1417
回复 0
|
赞 0
|
浏览 8.0k
#include<stdio.h> int main() { int a,cnt,i=0; int b[105]; while(~scanf("%d",&a))//循环输入 {while(a>0)//基本转换操作 { b[i++]=a%8; a=a/8; } cnt=i-1; for(i=cnt;i>=0;i--) printf("%d",b[i]); printf("\n"); i=0;//重置i } return 0; }
1
2
3
题目
八进制
题解数量
21
发布题解
在线答疑
热门题解
1
八进制 题解:
2
八进制 题解:为什么通过率只有百分之八十
3
八进制 (格式化输出)题解:
4
八进制 题解:printf("%o\n",n);
5
八进制 题解:孩子们,我秒了
6
“除x取余,逆序排列”
7
八进制 题解:
8
八进制 题解:C++实现
9
常规进制转换
10
十进制转八进制