Run ID:138967
提交时间:2025-11-30 16:49:20
#include <bits/stdc++.h> using namespace std; int main() { char a[9]={'H','C','N','O','F','P','S','K'},c[100]; int f,i,j,k,n,s,b[8]={1,12,14,16,19,31,32,39}; scanf("%d",&n); while (n--) { scanf("%s",c); f=i=0; while (i<strlen(c)) { j=0; while (j<8) { if (c[i]==a[j] and c[i]>='A' and c[i]<='Z') { s=b[j]; break; } j++; } i++; k=0; while (c[i]>='0' and c[i]<='9' and i<strlen(a)) { k=k*10+c[i]-'0'; i++; } if (k==0) f=f+s*1; else f=f+s*k; } printf("%d\n",f); } return 0; }