/** * Detect token nondecimal number * @param state * @param token * @return */ int scpiLex_NondecimalNumericData(lex_state_t * state, scpi_token_t * token) { int someNumbers = 0; token->ptr = state->pos; if (skipChr(state, '#')) { if (!iseos(state)) { if (isH(state->pos[0])) { state->pos++; someNumbers = skipHexNum(state); token->type = SCPI_TOKEN_HEXNUM; } else if (isQ(state->pos[0])) { state->pos++; someNumbers = skipOctNum(state); token->type = SCPI_TOKEN_OCTNUM; } else if (isB(state->pos[0])) { state->pos++; someNumbers = skipBinNum(state); token->type = SCPI_TOKEN_BINNUM; } } } if (someNumbers) { token->ptr += 2; // ignore number prefix token->len = state->pos - token->ptr; } else { token->type = SCPI_TOKEN_UNKNOWN; state->pos = token->ptr; token->len = 0; } return token->len > 0 ? token->len + 2 : 0; }
int getTeg(char *str){ int sum = 0; sum = isMODEL (str)+ isP (str)+ isSCORE (str)+ isCOMP (str)+ isRFILTER (str)+ isPFILTERs (str)+ isPFILTER (str)+ isSIZEX (str)+ isSIZEY (str)+ isWEIGHTS (str)+ isV (str)+ isVx (str)+ isVy (str)+ isD (str)+ isDx (str)+ isDy (str)+ isDxx (str)+ isDyy (str)+ isB (str)+ isPCA (str)+ isCASCADE_Th (str)+ isHYPOTHES_PCA(str)+ isDEFORM_PCA (str)+ isHYPOTHES (str)+ isDEFORM (str)+ isWEIGHTS_PCA (str)+ isPCAcoeff (str) ; return sum; }
int main(){ int times; scanf("%d\n",×); char input[20]; char tmpstr[20]; while(times-- >0){ char *s=input; while((*s++=getchar())!='\n'); *(s-1)=0; strcpy(tmpstr,input); if(isB(tmpstr)) //printf("%s-->%s\n",input,B2A(tmpstr)); printf("%s\n",B2A(tmpstr)); else printf("%s\n",A2B(tmpstr)); } }
int getTeg(char *str){ int sum = 0; sum = isMODEL (str)+ isP (str)+ isSCORE (str)+ isCOMP (str)+ isRFILTER (str)+ isPFILTERs (str)+ isPFILTER (str)+ isSIZEX (str)+ isSIZEY (str)+ isWEIGHTS (str)+ isV (str)+ isVx (str)+ isVy (str)+ isD (str)+ isDx (str)+ isDy (str)+ isDxx (str)+ isDyy (str)+ isB (str); return sum; }