#include<stdio.h> #include<string.h> int main() { char a[8]; long long sum=0; int i; int len=0; while(gets(a)){ len=strlen(a); for(i=0;i<len;i++){ if(a[i]>=‘A‘&&a[i]<=‘F‘){ sum=sum*16+a[i]-‘A‘+10; } else { sum=sum*16+a[i]-‘0‘; } } printf("%lld",sum); } return 0; }
原文:https://www.cnblogs.com/chen-kaige/p/14386684.html