6 条题解
-
1凌艺樽 (Lawrence劳伦斯) LV 10 @ 2023-9-10 12:35:35
#include <bits/stdc++.h> using namespace std; const int N=1e4+10; const int INF=0x3f3f3f3f; int a[N]; double sum; int ans,n; int main() { cin>>n; for(int i=1;i<=n;i++) { cin>>a[i]; sum+=a[i]; } sum/=n; for(int i=1;i<=n;i++) { if(a[i]<sum) { ans++; } } cout<<ans; return 0; }
-
12022-8-26 18:05:40@
/***************************************** 备注: ******************************************/ #include <queue> #include <math.h> #include <stack> #include <stdio.h> #include <iostream> #include <vector> #include <iomanip> #include <string.h> #include <algorithm> using namespace std; #define LL long long const int N = 1e5 + 10; const int INF = 0x3f3f3f3f; int main() { double n; double a[N]; cin >> n; double sum = 0; for(int i = 0 ; i < n ; i++ ) { cin >> a[i]; sum += a[i]; } double s = sum / n; int cnt = 0; for(int i = 0 ; i < n ; i++) { if(a[i] < s) cnt ++; } cout << cnt << endl; return 0; }
-
02024-2-17 18:56:51@
#include<iostream> #include<iomanip> #include<algorithm> #include<cstring> #include<bits/stdc++.h>//memset(a,0x3f,sizeof(a)); using namespace std;//cout<<fixed<<setprecision() int a[10005]; int main() { int s,t=0; double y=0; cin>>s; for(int i=0;i<=s-1;i++) { cin>>a[i]; } for(int i=0;i<=s-1;i++) { y+=a[i]; } y/=s; for(int i=0;i<=s-1;i++) { if(y>a[i]) { t++; } } cout<<t; return 0; }
-
02023-4-3 13:53:13@
#include<iostream> //#include<iomanip> //#include<math.h> using namespace std; const int N = 1e5 + 10;//1*10^5 + 10 const int INF = 0x3f3f3f3f; double n , a[N] , sum , avg , ans; int main(){ cin >> n ; for(int i = 1;i <= n;i++){ cin >> a[i]; sum += a[i]; } avg = sum / n; for(int i = 1;i <= n;i++){ if(a[i] < avg){ ans ++; } } //if(i == 1){ // pass //}else{ // pass //} cout << ans ; return 0; }
-
02023-4-2 21:45:16@
using namespace std; const int N = 1e5 + 10; const int INF = 0x3f3f3f3f; int main(){ double n; double a[N]; cin >> n; double sum = 0; for(int i = 0 ; i < n ; i++ ){ cin >> a[i]; sum += a[i]; } double s = sum / n; int cnt = 0; for(int i = 0 ; i < n ; i++){ if(a[i] < s) cnt ++; } cout << cnt << endl; return 0; }
-
-12023-1-30 16:46:56@
#include <queue>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
int main()
{
double s=0,x;
int b=0,n;
cin >> n;
double a[n+1];
for(int i=1;i<=n;i++)
{
cin >> a[i];
s += a[i];
}
x = s / n;
for(int i=n;i>=1;i--)
{
if(a[i] < x)b++;
}
cout << b;
return 0;
}
- 1
信息
- ID
- 1018
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 6
- 标签
- 递交数
- 506
- 已通过
- 173
- 上传者