Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: Jxricho

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

Language: cpp

Time: 0.002 second

Submitted On: 2025-10-16 09:03:51

#include<bits/stdc++.h>
#define ll long long
using namespace std;
main(){
	string s;
	cin>>s;
	ll cnt=stoll(s,nullptr,16);
	string s2=bitset<16>(cnt).to_string();
	s2.erase(0,s2.find_first_not_of('0'));
	if(s2.empty()){
		s="0";
	}
	stringstream s3;
	s3<<oct<<cnt;
	string ans=s3.str();
	cout<<s2<<'\n'<<ans;
}