Because the two solutions have equal molarity, and HCl and NaOH react 1:1
Total volume of solution = 20+20 = 40 ml.
What is the molarity of 0.3 mol HCl dissolved in 40ml solution:
1000/40*0.3 = 7.5M
Because [HCl] = 7.5M, [H+] = 7.5M
pH = -log [H+]
pH = -log 7.5
pH = -0.88