题解:#1054. 输出保留12位小数的浮点数 审核通过

lyh099 2025-10-14 17:10:18 5

保留小数会写吧。。。

不会的复习一下

printf("%.12f",a);

fixed << setprecision(12) << a;

都是保留小数位数的代码.

但值得注意的是printf会四舍五入,setprecision不会,需要特殊注意部分题目.

别问我怎么知道的%%%%%

但这题好像没限制用哪个.

所以没啥好讲的%%%

AC代码展示:

#include <bits/stdc++.h>
using namespace std;
int main() {
    int a;
    //这里小改了一下int
    cin >> a;
    cout << fixed << setprecision(12) << a;
}

试下杀猪刀

{{ vote && vote.total.up }}