This page is still under construction.

Parts of this page are still being built. What you see may change.

Acid and Base

Time limit1sMemory limit256 MB

Summary
Compute the pH from each given H+ or OH- concentration with the log formulas and print it rounded to two decimals.
Level

Easy1 of 10

Topics
Math, Implementation
Solved
No attempts yet

Problem

The pH of a solution measures how water ionizes to form H+H^+ (acids) or OH−OH^- (bases).

There are four variables (pHpH, pOHpOH, H+H^+, and OH−OH^-) and two equations:

pH=−log⁡10(H+)pH = -\log_{10}(H^+)

pOH=−log⁡10(OH−)pOH = -\log_{10}(OH^-)

They are also related by pH+pOH=14pH + pOH = 14.

Input

The first line contains the number of data sets. Each data set is either an H+H^+ concentration written as H = ... or an OH−OH^- concentration written as OH = ....

Output

For each data set, print the pH rounded to the nearest hundredth.

Examples1

  1. Example 1

    Input
    3
    H = 0.001
    OH = 0.001
    H = 0.012
    
    Expected output
    3.00
    11.00
    1.92