平均值(C++ cout直接输出就行,不用特判,最短代码) 题解:
P1132
发布于2024年5月13日 23:40
阅读数 1.1k
C++中std::cout输出浮点数默认精度是6位有效数字
#include<bits/stdc++.h>
using namespace std;
int a, b;
int main()
{
double res;
scanf("%d%d",&a, &b);
res = (a + b) * 1.0 / 2;
cout << res;
return 0;
}
登录后发布评论
暂无评论,来抢沙发