Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: Phat12
Problemset: แปลงเลขฐาน
Language: cpp
Time: 0.002 second
Submitted On: 2025-08-28 07:29:16
#include <bits/stdc++.h>
using namespace std;
int main() {
string a;
cin >> a;
int ten = stoi(a,0,16);
string oct="",bi="";
int temp=ten;
while (temp){
bi+=((temp)%2)+'0';
temp/=2;
}
temp=ten;
while (temp){
oct+=((temp)%8)+'0';
temp/=8;
}
reverse(bi.begin(),bi.end());
reverse(oct.begin(),oct.end());
cout << bi << '\n' << oct;
}