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