题解 | #统计同成绩学生人数#

统计同成绩学生人数

https://www.nowcoder.com/practice/987123efea5f43709f31ad79a318ca69

#include <iostream>
using namespace std;

int main() {
    int n;
    while (cin >> n && n != 0) { // 注意 while 处理多个 case
        double a[n];
        for (int i = 0; i < n; i++){	//输入
            cin >> a[i];
        }
        int score;	//给定分数
        cin>>score;
        int count = 0;
        for (int i = 0; i < n; i++){	//统计人数
            if (a[i] == score) count++;
        }
        cout << count << endl;	//输出统计数目
    }
}
// 64 位输出请用 printf("%lld")

全部评论

相关推荐

05-19 15:21
已编辑
门头沟学院 Java
白火同学:你才沟通了200,说实话,北上广深杭这里面你连一座城市的互联网公司都没投满呢,更别说还有各种准一线二线城市了。等你沟通突破了三位数,还没结果再考虑转行的事吧。
点赞 评论 收藏
分享
Twilight_m...:经典我朋友XXXX起手,这是那种经典的不知道目前行情搁那儿胡编乱造瞎指导的中年人,不用理这种**
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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