题解 | #统计同成绩学生人数#
统计同成绩学生人数
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")