POJ 2006 Litmus Test (简单数学&弱酸的电离常数)
2013-09-12 22:42
288 查看
Litmus Test
http://poj.org/problem?id=2006
Time Limit: 1000MS
Memory Limit: 30000K
Description
The pH scale measures the concentration of protons (H+) in a solution and, therefore, its acidity or alkalinity. The pH value of a solution is a number between 0 and 14; it is less than 7 if the solution is acidic, greater than 7 if the solution
is basic, and 7 if it is neutral.
The formula for calculating pH is
pH = -log10 [H+]
where [H+] is the concentration of protons measured in moles per litre.
To calculate the pH value of an acid, one has to determine the concentration of protons in the solution. When an acid is dissolved in water, an equilibrium is reached and is governed by the equation
Ka = [H+] [acid ions] / [acid]
where Ka is the acidity constant (known for each acid), [acid ions] is the concentration of the acid ions that have dissolved, and [acid] is the concentration of the undissolved acid. Before the acid is added, both [H+] and [acid ions]
are assumed to be 0.
For example, the acidity constant of methanoic acid is 1.6 * 10-4. Dissolving one mole of acid molecules results in one mole of H+ and one mole of acid ions. If the initial concentration of the methanoic acid is 0.1 moles/L and x moles
of acid are dissolved (per liter), then the final concentration at equilibrium would be 0.1 - x moles/L for the acid and x moles/L for H+ and the acid ions.
Input
The input consists of a number of test cases. Each test case contains 4 numbers on a line: two positive floating-point numbers specifying the acidity constant Ka and the original concentration of the acid (in moles/liter) added to the water, as well
as two positive integers m and n indicating that each mole of acid molecules is dissolved into m moles of H+ ions and n moles of acid ions. The floating-point numbers are specified in scientific notation as shown below. The input is terminated with
a line containing four zeros.
Output
For each test case, print on a line the pH value of the solution, rounded to 3 decimal places.
Sample Input
Sample Output
设酸电离了x mol,则有Ka=(mx*nx)/(c-x),解出x后乘上m就是[H+]([物质]表示该物质的浓度)
完整代码:
http://poj.org/problem?id=2006
Time Limit: 1000MS
Memory Limit: 30000K
Description
The pH scale measures the concentration of protons (H+) in a solution and, therefore, its acidity or alkalinity. The pH value of a solution is a number between 0 and 14; it is less than 7 if the solution is acidic, greater than 7 if the solution
is basic, and 7 if it is neutral.
The formula for calculating pH is
pH = -log10 [H+]
where [H+] is the concentration of protons measured in moles per litre.
To calculate the pH value of an acid, one has to determine the concentration of protons in the solution. When an acid is dissolved in water, an equilibrium is reached and is governed by the equation
Ka = [H+] [acid ions] / [acid]
where Ka is the acidity constant (known for each acid), [acid ions] is the concentration of the acid ions that have dissolved, and [acid] is the concentration of the undissolved acid. Before the acid is added, both [H+] and [acid ions]
are assumed to be 0.
For example, the acidity constant of methanoic acid is 1.6 * 10-4. Dissolving one mole of acid molecules results in one mole of H+ and one mole of acid ions. If the initial concentration of the methanoic acid is 0.1 moles/L and x moles
of acid are dissolved (per liter), then the final concentration at equilibrium would be 0.1 - x moles/L for the acid and x moles/L for H+ and the acid ions.
Input
The input consists of a number of test cases. Each test case contains 4 numbers on a line: two positive floating-point numbers specifying the acidity constant Ka and the original concentration of the acid (in moles/liter) added to the water, as well
as two positive integers m and n indicating that each mole of acid molecules is dissolved into m moles of H+ ions and n moles of acid ions. The floating-point numbers are specified in scientific notation as shown below. The input is terminated with
a line containing four zeros.
Output
For each test case, print on a line the pH value of the solution, rounded to 3 decimal places.
Sample Input
1.6e-04 1.0e-01 1 1 1.6e-04 1.0e-01 4 1 1.5e-05 5.0e-02 1 2 0 0 0 0
Sample Output
2.407 2.101 3.216
设酸电离了x mol,则有Ka=(mx*nx)/(c-x),解出x后乘上m就是[H+]([物质]表示该物质的浓度)
完整代码:
/*110ms,192KB*/ #include <cstdio> #include <cmath> int main(void) { double ka, acid; int m, n; while (scanf("%lf%lf%d%d", &ka, &acid, &m, &n), m) printf("%.3f\n", -log10((-ka + sqrt(ka * ka + (m << 2) * n * acid * ka)) / (n << 1))); return 0; }
相关文章推荐
- POJ 2006:Litmus Test 化学公式
- POJ 2006:Litmus Test 化学公式
- POJ 2006 Litmus Test(水~)
- poj 2006 Litmus Test 【即zoj 2351:计算酸的PH】
- POJ 1018 & HDU 1432 Lining Up 【简单几何】
- 51nod 1096 距离之和最小 && 1108-距离之和最小 V2(简单数学)&& 1110 距离之和最小 V3(逆思维)
- 数学之欧拉函数 &几道poj欧拉题
- ACM中的【数学知识】之【组合数学】(一) Polya定理的简单理解 POJ 1286
- POJ 2348& HDU 2147&HDU 1846&POJ 1067&HDU 1850 简单的博弈
- 基础题训练(简单数学题、字符串)P,MTHBGWB POJ-1051
- poj Big Number 1423 (数学 取对数&技巧)
- POJ3087 Shuffle'm Up 简单模拟
- HDU-1068 &&POJ-1466 Girls and Boys 简单二分图匹配
- POJ 2773 Happy 2006 数学题
- poj 2528 Mayor's posters 简单离散化+线段树
- POJ 2242 The Circumference of the Circle 简单数学
- poj 2488 A Knight's Journey 简单dfs回溯 字典序
- ACM: 简单题 poj 1152 (简单题也wr…
- 数学#扩展欧几里德 POJ 1061&2115&2891
- HDU-5310-Souvenir(C++ && 简单数学题)