Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: Tjeez

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

Language: cpp

Time: 0.003 second

Submitted On: 2026-09-26 14:09:10

//if youre looking for a good example DONT scroll down
//DONT scroll down
//DONT scroll down
//DONT scroll down
//DONT scroll down
//DONT scroll down
//DONT scroll down
//DONT scroll down
//DONT scroll down
//DONT scroll down
//DONT scroll down
//DONT scroll down
//DONT scroll down
//DONT scroll down
//DONT scroll down
//DONT scroll down
//DONT scroll down
//DONT scroll down
//DONT scroll down
//DONT scroll down
//DONT scroll down
//DONT scroll down
//DONT scroll down
//DONT scroll down
//DONT scroll down
//DONT scroll down
//DONT scroll down
//DONT scroll down
//DONT scroll down
//DONT scroll down
//DONT scroll down
//DONT scroll down
//DONT scroll down
//DONT scroll down
//DONT scroll down
//DONT scroll down
//DONT scroll down
//DONT scroll down
#include <iostream>
#include <vector>
using namespace std;
int main(){
	int arr[256*257]={0};
	string s16;
	cin >> s16;
	for(int i=0;i<s16.length() ; i++){
		if (s16[i]>=65){
			arr[i]=s16[i]-65+10;
		}
		else{
			arr[i]=s16[i]-49+1;
		}
	}
//	
//	for(int i=0 ; i<s16.length() ; i++){
//		cout<<arr[i]<<" "<<"\n";
//	}

	int temp=1;
	int s10=0; 
	for(int i=0;i<s16.length() ; i++){
		temp=1;
		for (int j=0 ; j<s16.length()-i-1 ;j++){
			temp*=16;
		}
		s10+=temp*arr[i];
	}
//	cout<<s10;
	int s2=s10;
	int s8=s10;
	int temp1=0,c=0;
	vector<int> v8;
	vector<int> v2;
	while(s2>0){
		temp1=s2%2;
		s2-=temp1;
		s2/=2;
		v2.push_back(temp1);
		c+=1;
	}
	for (int i=v2.size()-1; i>=0 ; i--){
		cout<<v2[i];
	}
	cout<<"\n";
	temp1=0;
	while(s8>0){
		temp1=s8%8;
		s8-=temp1;
		s8/=8;
		v8.push_back(temp1);
		c+=1;
	}
	for (int i=v8.size()-1; i>=0 ; i--){
		cout<<v8[i];
	}
}
//A=65 1=49