Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <string.h>
- #include <string>
- #include <algorithm>
- using namespace std;
- int main() {
- long long x, n = 0;
- int k = 0;
- cin >> x;
- if (x <= 7) {
- cout << x;
- }
- else {
- while (x > 0) {
- if (x % 8 == 0) {
- k++;
- }
- n = 10 * n + (x % 8);
- x = (x - (x % 8)) / 8;
- }
- string s = to_string(n);
- reverse(s.begin(), s.end());
- long long Num = atoll(s.c_str());
- if (k > 0) {
- for (int i = 0; i < k; i++) {
- Num = Num * 10;
- }
- }
- cout << Num;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement