CZH_xixi @ 2024-03-03 08:58:24
#include<bits/stdc++.h>
using namespace std;
int main(){
float a,c;
cin>>a;
int d=a;
float b;
for(int i=1;i<=a;i++)
{
cin>>b;
c+=b;
}
printf("%.2lf",c/a);
}
95分......
by MsgNotFound @ 2024-03-03 09:01:38
@2023_1202
开double
#include<bits/stdc++.h>
using namespace std;
int main(){
double a,c;
cin>>a;
int d=a;
double b;
for(int i=1;i<=a;i++)
{
cin>>b;
c+=b;
}
printf("%.2lf",c/a);
}
by 0LCH0 @ 2024-03-03 09:02:36
用double能过吗
by CZH_xixi @ 2024-03-03 09:03:07
@42_TZY 谢谢
by MsgNotFound @ 2024-03-03 09:03:52
@0LCH0 可以啊,题解不都是double,我也是用double过的啊
by fengyuanwanye666 @ 2024-06-02 11:22:23
#include<iostream>
using namespace std;
int main(){
int n;
cin>>n;
double sum=0;
for(int i=1;i<=n;i++){
int x;
cin>>x;
sum+=x;
}
printf("%.2lf",sum/n);
return 0;
}
by 0x3E @ 2024-07-06 22:08:02
#include <stdio.h>
using namespace std;
int main() {
int n, i;
double sum = 0;
scanf("%d", &n);
for (i = 1; i <= n; i ++) {
int a;
scanf("%d", &a);
sum += a;
}
printf("%.2lf", sum/n);
return 0;
}