题意:给定一个只由H、C、O三种分子组成物质的分子式,求相对分子质量
len<=10
思路:队友写的
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <string.h>
#include <limits.h>
#include <string>
#include <iostream>
#include <queue>
#include <math.h>
#include <stack>
#include <map>
#define left (now<<1)
#define right ((now<<1)+1)
#define mid ((l+r)>>1)
using namespace std;
typedef long long int lint; int n,t;
const int MAXN = 1e5 + ; char str[MAXN]; int main(){
scanf("%d",&t);
while(t--){
scanf("%s",str); int len = strlen(str); lint ans = ;
for(int i = ; i < len; ++i){
if(str[i] == 'H'){
++ans;
}else if(str[i] == 'C'){
ans += ;
}else{
ans += ;
}
}
printf("%I64d\n",ans);
}
return ;
}