诈骗 思维 T1

C-现在是,学术时间 (I)_2023牛客寒假算法基础集训营1 (nowcoder.com)

H取决于该教授至少有H篇论文引用量大于等于H。每个人都有一篇论文。先不管引用量, 如果一个教授有H指数, 那么至少发布H篇论文, 而论文总量是和教授人数相等为n, 最多也就是所有文章放到一个人身上发布, 结果为n。或者每个人发布自己的, 同样会是n。

故总流程为在读入论文引用量时H, 若 H > 0, 则将 res++, 反之则不加。

#include <iostream>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
using namespace std;
 
int main()
{
    int T;
    cin >> T;
    while(T--)
    {
        int n,cnt = 0;
        cin >> n;
        for(int i = 0; i < n; i++)
        {
            int t = 0;
            cin >> t;
            if(t) cnt++;
        }
        cout << cnt << endl;
    }
    return 0;
}