Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: kinzap
Problemset: แปลงเลขฐาน
Language: cpp
Time: 0.002 second
Submitted On: 2025-10-12 14:47:11
#include <iostream>
#include <string>
#include <math.h>
using namespace std;
string a,song,paed,d;
long long sum,b,c;
int main(){
cin >> a;
for(int i = a.length();i>0;i--){
if(a[i-1] >= 65){
b= a[i-1]-'A'+10;
}
else {
b= a[i-1]-'0';
}
//cout << b <<endl;
sum += b*pow(16,a.length()-i);
}
b=sum;
while(b>0){
c = b%2;
d=to_string(c);
song = d + song;
b/=2;
}
cout << song << endl;
while(sum>0){
c = sum%8;
d=to_string(c);
paed = d + paed;
sum/=8;
}
cout << paed;
}