题解 | #八进制#和二进制一样
八进制
https://www.nowcoder.com/practice/eda051c1effc4dffa630bc8507f0c5f7
#include <iostream> #include <string> #include <vector> #include <algorithm> #include <stack> #include <map> using namespace std; int main() { stack<int> mystack; int n; while (scanf("%d", &n) != EOF) { //转为8进制 while (n != 0) { int t = n % 8; mystack.push(t); n /= 8; } while (!mystack.empty()) { int t = mystack.top(); mystack.pop(); printf("%d", t); } printf("\n"); } } // 64 位输出请用 printf("%lld")