Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: Krovmoroz

Problemset: แปลงเลขฐาน

Language: cpp

Time: 0.004 second

Submitted On: 2025-11-04 17:53:51

#include <bits/stdc++.h>
using namespace std;

int x;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    cin >> std::hex >> x;
    
    if (!x) {cout << 0 << "\n" << 0; return 0;}
    
    int msb = 31 - __builtin_clz(x);
    for (int i = msb; i >= 0; i--) cout << ((x >> i)&1);
    
    cout << "\n" << std::oct << x;
}