Zoj 2351 litmus test

Source: Internet
Author: User

Zoj 2351
Litmus test

This question is the key, and I remember the chemistry knowledge about the Ionization Equilibrium Constant in the third year of my heart and lungs. Then I think of the root equation of the quadratic equation, and I can finally do it.

The four numbers are Ionization Equilibrium Constants, initial concentrations, which are several yuan of acid. An acid molecule separates several acid ions, then, the concentration of the dissolved and undissolved parts is calculated based on the question. Well.

The code and precautions are as follows:

# Include <stdio. h> # include <math. h> int main () {int N, I, j, m, n; double K1, K2, pH, X; scanf ("% d", & N ); for (I = 1; I <= N; I ++) {getchar (); For (j = 1; j ++) {scanf ("% lf", & K1, & K2); // the receipt of scientific notation is the same as that of the double type. Scanf ("% d", & M, & N ); if (k1 = 0 & k2 = 0 & M = 0 & n = 0) break; X = (SQRT (K1 * k1 + 4 * m * n * K1 * K2)-k1)/2/N; ///// the plus and minus signs of the formula must be carefully written to the pH =-1 * log (X)/log (10); printf ("%. 3lf \ n ", pH);} if (I! = N) printf ("\ n");} return 0 ;}

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.