3 条题解

  • 2
    @ 2025-1-12 15:37:43

    输出语句小数点后保留3位,sum的值输出时保留3位小数: printf("%.3f",sum);

    如果sum的值是1.2,运行结果为1.200

    • 2
      @ 2024-8-5 19:26:44

      #include

      using namespace std;

      int main() { double a, b, h, s; scanf("%lf%lf%lf",&a,&b,&h); s = (a+b)*h/2; printf("%.3f\n", s); return 0; } 刚学scanfprintf()不太熟练

      • 1
        @ 2023-7-27 18:02:12

        #include using namespace std; int main() { double a,b,h,s; scanf("%lf%lf%lf",&a,&b,&h); s=(a+b)*h/2; printf("%.3f\n",s); return 0; }

        • 1

        信息

        ID
        307
        时间
        1000ms
        内存
        256MiB
        难度
        5
        标签
        (无)
        递交数
        537
        已通过
        186
        上传者