patA1027 Colors in Mars
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
const int maxn=10001;
char d[maxn];
int dsize=0;
void change(int x){
int count=0;
do{
if(x%13<=9){
d[dsize++]=x%13+'0';
}else{
d[dsize++]=x%13-10+'A';
}
x/=13;
count++;
}while(x!=0);
if(count==1){
// char temp=d[dsize-1];
// d[dsize-1]='0';
d[dsize++]='0';
}
reverse(d+dsize-2,d+dsize);
}
int main(int argc, char** argv) {
int a,b,c;
scanf("%d %d %d",&a,&b,&c);
change(a);
change(b);
change(c);
printf("#");
//倒置下字符数组;
// reverse(d,d+dsize);
for(int i=0;i<dsize;i++){
printf("%c",d[i]);
}
return 0;
#include <cstdio>
#include <algorithm>
using namespace std;
const int maxn=10001;
char d[maxn];
int dsize=0;
void change(int x){
int count=0;
do{
if(x%13<=9){
d[dsize++]=x%13+'0';
}else{
d[dsize++]=x%13-10+'A';
}
x/=13;
count++;
}while(x!=0);
if(count==1){
// char temp=d[dsize-1];
// d[dsize-1]='0';
d[dsize++]='0';
}
reverse(d+dsize-2,d+dsize);
}
int main(int argc, char** argv) {
int a,b,c;
scanf("%d %d %d",&a,&b,&c);
change(a);
change(b);
change(c);
printf("#");
//倒置下字符数组;
// reverse(d,d+dsize);
for(int i=0;i<dsize;i++){
printf("%c",d[i]);
}
return 0;
}