//#include "stdafx.h"//vc++6.0加上这一行.
#include "stdio.h"
#include "stdlib.h"
int main(void){
int n;
char x[9];
printf("Input n(int hex like 0x89fd)...\n");
scanf("%d",&n);
while(n--){
scanf("%s",x);
printf("%ld\n",strtol(x+2,NULL,16));
}
return 0;
}
#include
#include
int main()
{
char c[100];
int i,leng,sum,a,N;
scanf("%d",&N);
while(N--)
{
sum=0;a=1;
scanf("%s",c);
leng=strlen(c);
for(i=leng-1;i>=1;i--,a=a*16)
if(c[i]>='a' && c[i]<='f') sum+=(c[i]-87)*a;
else if(c[i]>='A'&&c[i]<='F') sum+=(c[i]-55)*a;
else if(c[i]>='0'&&c[i]<='9') sum+=(c[i]-48)*a;
printf("%d\n",sum);
}
return 0;
}
来自大华科的渣渣