首页
DreamJudge
院校信息
考研初试
考研复试
保研专区
讨论区
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
mlx
2026年2月4日 21:23
平均值 题解:
P1132
回复 0
|
赞 0
|
浏览 73
#include<iostream> using namespace std; double a,b; int main() { scanf("%lf %lf",&a,&b); a=(a+b)/2; printf("%g",a); return 0; }
xsw
2026年1月31日 12:25
平均值 题解:
P1132
回复 0
|
赞 0
|
浏览 88
#include<iostream> using namespace std; int main() { int a, b; cin >> a >> b; cout << (a + b) / 2.0 << endl; return 0; }
曾不会
2026年1月25日 21:05
平均值 题解:
P1132
回复 0
|
赞 0
|
浏览 129
a,b=map(int,(input().split())) print("%g"%((a+b)/2))
qimengzhi
2025年10月2日 17:13
平均值 题解:C
P1132
回复 0
|
赞 9
|
浏览 650
#include <stdio.h> void main() { int a,b; scanf("%d %d",&a,&b); double c; c = (double)(a + b)/2.0; printf("%g",c); /*%g格式会自动省略小数点后多余的零*/ return 0; }
阿灿
2025年3月15日 02:55
平均值 题解:怎么直接这样就行
P1132
回复 1
|
赞 6
|
浏览 1.3k
#include<bits/stdc++.h> using namespace std; int main(){ double a,b; cin>>a>>b; cout<<(a/2+b/2)<<endl; return 0; }
wwj0102
2025年3月15日 20:39
平均值 题解:%g解决
P1132
回复 0
|
赞 7
|
浏览 1.0k
#include<bits/stdc++.h> using namespace std; int main(){ double a,b; cin >> a >> b; printf("%g\n", (a + b) / 2); return 0; }
zxjrheaven
2025年3月12日 22:54
平均值 题解:暴力,这题这么水正确率为什么比好多难题还低?
P1132
回复 0
|
赞 3
|
浏览 1.3k
#include <bits/stdc++.h> using namespace std; int main() { long long a,b; cin>>a>>b; if((a+b)%2==0)cout<<(a+b)/2; else cout<<(a+b-1)/2<<".5"; retu...
Dayna
2024年12月25日 18:58
平均值 题解:
P1132
回复 0
|
赞 39
|
浏览 1.8k
#include <stdio.h> int main(){ int a,b; scanf("%d%d",&a,&b); if((a+b)%2==0){ printf("%.0lf\n",(double)(a+b)/2); } else printf("%.1lf\n",(double)(a...
2107020202
2024年8月16日 23:40
平均值 题解:
P1132
回复 0
|
赞 7
|
浏览 1.2k
#include<iostream> using namespace std; int n,m; double ave; int main() { cin>>n>>m; ave=(double)(n+m)/2;//将n,m转换为double类型进行计算并赋值给ave cout<<res<<endl;//直接用cout输出 return 0; }
Candour
2024年5月13日 23:40
平均值(C++ cout直接输出就行,不用特判,最短代码) 题解:
P1132
回复 0
|
赞 8
|
浏览 1.6k
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; }
1
2
题目
平均值
题解数量
15
发布题解
在线答疑
热门题解
1
平均值 题解:
2
c-主要学会%g的使用
3
平均值
4
平均值 题解:C
5
平均值 题解:注意结果有小数和无小数的输出格式
6
平均值(C++ cout直接输出就行,不用特判,最短代码) 题解:
7
平均值 题解:%g解决
8
平均值 题解:
9
求两个整数的平均值
10
平均值 题解:怎么直接这样就行