题意:给定一个只由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 ;
}

最新文章

  1. zsh 自动补全导致命令显示重复
  2. GitHub注册账号
  3. poj2888 Magic Bracelet
  4. JdbcTemplate操作数据库
  5. iOS开发经常使用宏定义
  6. 视频编辑SDK---我们只提供API,任你自由设计炫酷的功能
  7. Mybatis基本用法--下
  8. activiti 任务监听参数的配置
  9. KFCM算法的matlab程序
  10. SpringBoot2.0 最简单的 idea 快速创建项目
  11. CSS之旋转立方体
  12. 222. Count Complete Tree Nodes -- 求完全二叉树节点个数
  13. 禅道BUG管理工具使用链接存储
  14. Oracle事务和锁机制
  15. HTTP响应代码集合
  16. Word 2013 无法撤销操作的错误
  17. 手把手教你用git和SourceTree上传项目到github细解(转)
  18. Android测试读写sd卡文件与写sd卡文件耗时
  19. http请求在asp.net中的请求过程
  20. JS实现数组去重的方法(6种)

热门文章

  1. CS 分解
  2. 【Python】使用cmd模块构造一个带有后台线程的交互命令行界面
  3. Encryption-基础:base64加解密
  4. QT+动手设计一个登陆窗口+布局
  5. archlinux alsa安装,音量设置和音量信息保存
  6. jQuery绑定动态元素的点击事件无效
  7. 把所有界面的状态栏字体颜色设置为白色--iOS开发系列---项目中成长的知识一
  8. Vuex基本概念
  9. substring substr slice 区别
  10. ps命令查看子进程