Relative atomic mass
Relative atomic mass
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 617 Accepted Submission(s):
516
quantity, the ratio of the average mass of atoms of an element (from a single
given sample or source) to 1
of the mass of an atom of carbon-12 (known as the unified atomic mass
unit).
You need to calculate the relative atomic mass of a molecule, which
consists of one or several atoms. In this problem, you only need to process
molecules which contain hydrogen atoms, oxygen atoms, and carbon atoms. These
three types of atom are written as ’H’,’O’ and ’C’ repectively. For your
information, the relative atomic mass of one hydrogen atom is 1, and the
relative atomic mass of one oxygen atom is 16 and the relative atomic mass of
one carbon atom is 12. A molecule is demonstrated as a string, of which each
letter is for an atom. For example, a molecule ’HOH’ contains two hydrogen atoms
and one oxygen atom, therefore its relative atomic mass is 18 = 2 * 1 +
16.
the number of molecules. In the next N lines, the i-th line contains a string,
describing the i-th molecule. The length of each string would not exceed
10.
H
C
O
HOH
CHHHCHHOH
12
16
18
46
- #include<iostream>
- #include<cstdio>
- using namespace std;
- string s;
- int ans,n;
- int main()
- {
- scanf("%d",&n);
- for(int i=;i<=n;i++)
- {
- cin>>s;ans=;
- for(int i=;i<s.size();i++)
- {
- if(s[i]=='C')ans+=;
- if(s[i]=='O')ans+=;
- if(s[i]=='H')ans++;
- }
- printf("%d\n",ans);
- }
- return ;
- }
Relative atomic mass的更多相关文章
- HDU 5949 Relative atomic mass 【模拟】 (2016ACM/ICPC亚洲区沈阳站)
Relative atomic mass Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Oth ...
- 【HDOJ5949】Relative atomic mass(签到)
题意:给定一个只由H.C.O三种分子组成物质的分子式,求相对分子质量 len<=10 思路:队友写的 #include <stdio.h> #include <vector&g ...
- 2016ACM/ICPC亚洲区沈阳站-重现赛赛题
今天做的沈阳站重现赛,自己还是太水,只做出两道签到题,另外两道看懂题意了,但是也没能做出来. 1. Thickest Burger Time Limit: 2000/1000 MS (Java/Oth ...
- 2016ACM/ICPC亚洲区沈阳站 - A/B/C/E/G/H/I - (Undone)
链接:传送门 A - Thickest Burger - [签到水题] ACM ICPC is launching a thick burger. The thickness (or the heig ...
- ACM Shenyang Onsite 2016 题目
A. Thickest Burger 1000ms 262144K ACM ICPC is launching a thick burger. The thickness (or the heig ...
- 2016ACM/ICPC亚洲区沈阳站 Solution
A - Thickest Burger 水. #include <bits/stdc++.h> using namespace std; int t; int a, b; int main ...
- The 2016 ACM-ICPC Asia Shenyang Regional Contest
A. Thickest Burger 大数 × 2 + 小数 #include <cstdio> #include <algorithm> using namespace st ...
- 2016 ACM/ICPC亚洲区沈阳站
A B C D E F G H I J K L M O O O $\varnothing$ $\varnothing$ $\varnothing$ $\varnothing$ $\varnothi ...
- absurd, abundant
absurd How: absolutely, completely, clearly, faintly, manifestly, obviously, patently, quite, rather ...
随机推荐
- CNN网络--VGGNet
Simonyan, Karen, and Andrew Zisserman. "Very deep convolutional networks for large-scale image ...
- Python基础语法02-运算符
Python 运算符 算术运算符 比较(关系)运算符 赋值运算符 逻辑运算符 位运算符 成员运算符 身份运算符 运算符优先级 Python运算符优先级 以下表格列出了从最高到最低优先级的所有运算符: ...
- [c#菜鸟]lambda表达式
what 一.定义 Lambda 表达式是一种可用于创建 委托 或 表达式目录树 类型的 匿名函数 .通过使用 lambda 表达式,可以写入可作为参数传递或作为函数调用值返回的本地函数.(微软) 理 ...
- HDU2256-Problem of Precision(矩阵构造+高速幂)
pid=2256">题目链接 题意:求sqrt(sqrt(2) + sqrt(3)) ^ 2n MOD 1024 思路: 代码: #include <iostream> # ...
- DVBS/S2在数字电视系统中的应用 三 (LNB介绍)
DVBS/S2在数字电视系统中的应用 三 (LNB介绍) 老谢在前面两篇文章中(例如以下).都有提到LNB这一概念. DVBS/S2在数字电视系统中的应用 一 (DVBS/S2接收系统Block Di ...
- Android 设定横屏,禁止屏幕旋转,Activity重置 [更新视频播放器相关]
1. 设定屏幕方向 当指定了屏幕的方向后(非SCREEN_ORIENTATION_UNSPECIFIED),屏幕就不会自己主动的旋转了 有2中方式控制屏幕方向: 1.1 改动AndroidManife ...
- WMS8_条码界面操作简要说明(包装作业)
说明:条码界面的主要用途是包装作业 这个客户端,完全是JS实现的 可以从 All operation看板视图 Picking的表单视图 All operatio ...
- ffplay 播放m3u8 hls Failed to open segment of playlist 0
用ffplay 播放m3u8文件 出现 Failed to open segment of playlist 0,Error when loading first segment 'test0.ts' ...
- 利用反射和泛型把Model对象按行储存进数据库以及按行取出然后转换成Model 类实例 MVC网站通用配置项管理
利用反射和泛型把Model对象按行储存进数据库以及按行取出然后转换成Model 类实例 MVC网站通用配置项管理 2018-3-10 15:18 | 发布:Admin | 分类:代码库 | 评论: ...
- IDEA 适用技巧
快速打印 sout - System.out.println(); serr - System.err.println(); //在控制台中是红色的 输入sout,按下enter键,生成System. ...