1. cout的setprecision头文件:#include<iomanip>
cout<<setprecision(1)<<fixed<<"T "<<num1<<" D "<<num2<<" H "<<calc_h(num1,num2)<<endl;
2. printf打印double,用%f,printf("%.2f",num1);
scanf输入double,用%lf,scanf("%lf",&num1);
3. cin,cout因为同步会比scanf,printf慢
解决方式,在main函数里加上
ios::sync_with_stdio(false);
原文:https://www.cnblogs.com/Kinghao0319/p/14635475.html