题解 | #谁是你的潜在朋友#

谁是你的潜在朋友

https://www.nowcoder.com/practice/0177394fb25b42b48657bc2b1c6f9fcc

#include <stdio.h>

int main() {
    int m, n;
    int cnt[201] = {0};
    while (scanf("%d %d", &n, &m) != EOF) {
        int a[n];
        for (int i = 0; i < n; i++) {
            int temp;
            scanf("%d", &temp);
            a[i] = temp;
            cnt[temp]++;
        }
        for (int i = 0; i < n; i++) {
            int temp = cnt[a[i]] - 1;
            if (temp > 0) {
                printf("%d\n", temp);
            } else if (temp == 0) {
                printf("BeiJu\n");
            }
        }
    }
    return 0;
}

全部评论

相关推荐

点赞 收藏 评论
分享
牛客网
牛客企业服务