牛客网 牛客小白月赛1 A.简单题-控制输出格式setiosflags()函数+setprecision()函数

水一水博客,都不好意思写这篇博客,毕竟已经不是大一的了。

难得能把一整套题都写出来(日常智障)。但是在这里不写G题あなたの蛙は旅⽴っています的题解。

有毒,G题关了流同步只能过94%的样例,说我运行超时,开着就过了。无语,不想写。

A.简单题

链接:https://www.nowcoder.com/acm/contest/85/A
来源:牛客网

 

控制输出格式就可以,传送门:看看就会了

代码:

 1 #include<iostream>
 2 #include<cstring>
 3 #include<cstdio>
 4 #include<cmath>
 5 #include<cstdlib>
 6 #include<algorithm>
 7 #include<iomanip>
 8 using namespace std;
 9 int main(){
10     int t,c;
11     double a,b;
12     cin>>t;
13     while(t--){
14         cin>>a>>b>>c;
15         double ans=exp(a)*b;
16         cout<<setiosflags(ios::fixed)<<setprecision(c)<<ans<<endl;
17     }
18 }



 
原文地址:https://www.cnblogs.com/ZERO-/p/8597952.html