虽然样例一没输出,样例二输出莫名其妙的正方形与长方形。。。但是没错吧。。。wtcl
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
//255=FF
using namespace std;
const int kkk=15;
char num1,num2,num3,num4,num5,num6,hehe;
int doo(char x,char y){
int yy=0;
if(y>='A'&&y<='F'){
if(y=='A')yy=10;
else if(y=='B')yy=11;
else if(y=='C')yy=12;
else if(y=='D')yy=13;
else if(y=='E')yy=14;
else if(y=='F')yy=15;
}else yy=y-'0';
int xx=0;
if(x>='A'&&x<='F'){
if(x=='A')xx=10;
else if(x=='B')xx=11;
else if(x=='C')xx=12;
else if(x=='D')xx=13;
else if(x=='E')xx=14;
else if(x=='F')xx=15;
}else xx=x-'0';
xx*=16;
return xx+yy;
}//把十六进制转化成十进制
void f(int x){
int az=x;
int tmp1=0,tmp2=0;
tmp2=az%16;
az=az/16;
tmp1=az%16;
char tmp3=0,tmp4=0;
if(tmp2>=10&&tmp2<=15){
if(tmp2==10)tmp4='A';
else if(tmp2==11)tmp4='B';
else if(tmp2==12)tmp4='C';
else if(tmp2==13)tmp4='D';
else if(tmp2==14)tmp4='E';
else if(tmp2==15)tmp4='F';
}else tmp4=tmp2;
if(tmp1>=10&&tmp1<=15){
if(tmp1==10)tmp3='A';
else if(tmp1==11)tmp3='B';
else if(tmp1==12)tmp3='C';
else if(tmp1==13)tmp3='D';
else if(tmp1==14)tmp3='E';
else if(tmp1==15)tmp3='F';
}else tmp3=tmp1;
cout<<tmp3<<tmp4;
return;
}//把十进制转化成16进制
int main(){
//cin>>hehe>>num1>>num2>>num3>>num4>>num5>>num6;
hehe=getchar();num1=getchar();num2=getchar();
num3=getchar();num4=getchar();num5=getchar();num6=getchar();
rewind(stdin);
cout<<"#";
int h=doo(num1,num2);
int hh=doo(num3,num4);
int hhh=doo(num5,num6);
h=255-h;
hh=255-hh;
hhh=255-hhh;
f(h);f(hh);f(hhh);
return 0;
}
求助,谢谢鸭