22220 辅导计划

辅导计划

https://ac.nowcoder.com/acm/problem/22220

#include<iostream>
using namespace std;
int main()
{
    int n;
    while(cin>>n)
    {
        int a[n];
        float s=0, r;
        for(int i=0; i<n; i++)
        {
            cin>>a[i];
            s=s+a[i];
        }
        r=(float)s/n;
        for(int i=0; i<n; i++)
            if(a[i]<r)
                cout<<a[i]<<" ";
        cout<<endl;
    }
    return 0;
}

只要s和r都是float就可以,15行的(float)可以没有

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务