题解 | #八进制#
八进制
https://www.nowcoder.com/practice/eda051c1effc4dffa630bc8507f0c5f7
入门基础题
#include <iostream> #include <algorithm> using namespace std; int main() { int n; while (cin >> n) { string s = ""; while (n) { s += '0' + n % 8; n /= 8; } reverse(s.begin(), s.end()); cout << s << endl; } }
while True: try: n = int(input()) print(oct(n)[2:]) except: break