1 条题解

  • 0
    @ 2024-12-24 9:14:32

    C++ :

    #include<bits/stdc++.h>
    using namespace std;
    double n[100005],x,z,ans;
    int a;
    int main(){
    	while(cin>>x){
    		n[a]=x;
    		a=a+1;
    		z=z+x;
    	}
    	z=z/a;
    	for(int i=0;i<a;i++){
    		if(n[i]<z)ans++;
    	}
    	cout<<ans;
    }
    

    Python :

    # coding=utf-8
    x = input () .split()
    z = 0
    j = 0
    a = 0
    for i in x:
        y = int (i)
        z += y
        j += 1
    c = z/j
    for i in x:
        y = int (i)
        if ( y < c ):
            a += 1
    print (a)
    
    • 1

    信息

    ID
    571
    时间
    1000ms
    内存
    128MiB
    难度
    (无)
    标签
    递交数
    0
    已通过
    0
    上传者