题解 | #公务员面试#

公务员面试

https://www.nowcoder.com/practice/f3a134908d5b41869f14f58307008a97

#include <stdio.h>
int cmp(const void* p1, const void* p2){
    return *(int *)p1 -*(int*)p2;
}
int main() {
    int score[7];
    while(scanf("%d %d %d %d %d %d %d", &score[0],&score[1],&score[2],&score[3],&score[4],&score[5],&score[6]) != EOF){
        float sum = 0;
        qsort(score, 7, sizeof(int), cmp);//升序排列
        for(int i = 1; i < 6; ++i){
            sum += score[i];
        }
        printf("%.2f\n", sum/5);
    }
    return 0;
}

全部评论

相关推荐

程序员鼠鼠_春招版:都很烂大街,rpc也基本没人问,考研吧,不然就包装一段实习再去
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务