#include <stdio.h>
#include <string.h>
#include <math.h>
void main(void)
{
char szHex[4],szRaw[] = "g2sh8iBof";
int i
,j
=0,iRet
= 0 ,len
= strlen(szRaw
);
for (i = 0 ; i < len; i++){
if(//anscii 0-9
szRaw[i] >= '0' && szRaw[i] <= '9'
//anscii A-F
|| szRaw[i] >= 'A' && szRaw[i] <= 'F'
//anscii a-f
|| szRaw[i] >= 'a' && szRaw[i] <= 'f'
){
szHex[j++] = szRaw[i];
}
}
for(i = 0; i < j; i++){
if(szHex[i] >= '0' && szHex[i] <= '9' )
iRet
+= ( szHex
[i
] - '0' ) * pow(16, 4-i
-1);
if(szHex[i] >= 'A' && szHex[i] <= 'F')
iRet
+= (szHex
[i
] - 'A' + 10) * pow(16, 4-i
-1);
if(szHex[i] >= 'a' && szHex[i] <= 'f')
iRet
+= (szHex
[i
] - 'a' + 10) * pow(16, 4-i
-1); }
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdHJpbmcuaD4KI2luY2x1ZGUgPG1hdGguaD4KCnZvaWQgbWFpbih2b2lkKQp7CgljaGFyIHN6SGV4WzRdLHN6UmF3W10gPSAiZzJzaDhpQm9mIjsKCglpbnQgaSxqPTAsaVJldCA9IDAgLGxlbiA9IHN0cmxlbihzelJhdyk7CgoJZm9yIChpID0gMCA7IGkgPCBsZW47IGkrKyl7CgkJCgkJaWYoLy9hbnNjaWkgMC05CgkJCXN6UmF3W2ldID49ICcwJyAmJiBzelJhd1tpXSA8PSAnOScgCgkJCS8vYW5zY2lpIEEtRgoJCQl8fCBzelJhd1tpXSA+PSAnQScgJiYgc3pSYXdbaV0gPD0gJ0YnCgkJCS8vYW5zY2lpIGEtZgoJCQl8fCBzelJhd1tpXSA+PSAnYScgJiYgc3pSYXdbaV0gPD0gJ2YnCgkJCSl7CgkJCXN6SGV4W2orK10gPSBzelJhd1tpXTsKCQl9CgoKCX0KCgoJZm9yKGkgPSAwOyBpIDwgajsgaSsrKXsKCQlpZihzekhleFtp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