题解 | 统计同成绩学生人数
统计同成绩学生人数
https://www.nowcoder.com/practice/987123efea5f43709f31ad79a318ca69
#include <iostream> #include <vector> using namespace std; int main() { int n; while (cin >> n) { if (n == 0) break; vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } int target; cin >> target; int count = 0; for (int i = 0; i < n; i++) { if (a[i] == target) count++; } cout << count << endl; } } // 64 位输出请用 printf("%lld")