UVA1586

时间:2021-02-03 10:03:23
#include<stdio.h>
#include<string.h>
#include<ctype.h>
int main(){
    int n;
    ];
    int num;//数字
    scanf("%d",&n);
    ;j<n;j++){
        scanf("%s",s);
        int len=strlen(s);
        double t=0.0;
        ;
        num=;//初始化为0
        ;i<len;i++){
            if(s[i] == 'C'){
                t=12.01;
                count += t;
            }
            else if(s[i] == 'H'){
                t=1.008;
                count += t;
            }
            else if(s[i] == 'O'){
                t=16.00;
                count += t;
            }
            else if(s[i] == 'N'){
                t=14.01;
                count += t;
            }
            else {
                int a;
                a = (s[i]-');
                                //判断数字有几位
                ])){
                    num += a;
                    count += (num-)*t;
                    num=;
                }
                ;
            }
        }
        printf("%.3f\n",count);
    }
    ;
}