Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: .n0t_gloomy.
Problemset: แปลงเลขฐาน
Language: cpp
Time: 0.003 second
Submitted On: 2025-09-29 21:38:07
#include <bits/stdc++.h>
using namespace std;
string bin(int b10)
{
string ans = "";
while (b10 > 0)
{
ans = ans + to_string(b10%2);
b10 = b10/2;
}
reverse(ans.begin(),ans.end());
return ans;
}
int main()
{
string b16;
cin>>b16;
int b10 = stoi(b16,nullptr,16);
cout<<bin(b10)<<"\n";
cout<<oct<<b10;
}