1 条题解

  • 0
    @ 2025-3-8 21:57:43
    #include <iostream>
    #include <bits/stdc++.h>
    
    #include <iomanip> 
    // cout.setf(ios::fixed);
    // cout << setprecision(2) << 2.112 ; -> 2.11
    
    using namespace std;
    
    int main(){
        double c,k,f;
        cin >> k;
        c = k-273.15;
        f = c*1.8+32;
        cout.setf(ios::fixed);
        if(f>=212) cout << "Temperature is too high!";
        else cout << setprecision(2) << c << " " << setprecision(2) << f;
    }
    

    使用 cout.setf(ios::fixed); cout << setprecision(n) << x 即可将x输出保留n位小数。

    信息

    ID
    35254
    时间
    1000ms
    内存
    512MiB
    难度
    1
    标签
    递交数
    48
    已通过
    6
    上传者