让人崩溃的输入格式
另外,数据量很大,用cin会超时
1 #include <iostream>
2 #include <cmath>
3
4 using namespace std;
5
6 int main()
7 {
8 int N;
9 cin >> N;
10 getchar();
11 for (int i = 0; i < N; i++)
12 {
13 double ka,b;
14 int m,n;
15 scanf("%lf %lf %d %d",&ka,&b,&m,&n);
16 //cin >> ka >> b >> m >> n;
17 while (ka!=0.0 && b!=0.0 && m!=0 && n!=0)
18 {
19 double x = ((-1)*ka+sqrt(ka*ka+4*m*n*ka*b))/(2*m*n);
20 double pH = -log10(m*x);
21 printf("%.3f\n",pH);
22 scanf("%lf %lf %d %d",&ka,&b,&m,&n);
23 //cin >> ka >> b >> m >> n;
24 }
25
26 if (i!=N-1) {
27 printf("\n");
28 getchar();
29 }
30 }
31 //system("pause");
32 return 0;
33 }