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

谁是你的潜在朋友

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

//
// Created by yang on 2023/5/23.
//
#include "cstdio"

using namespace std;

int main(){
    int N, M, books[201] = {0};
    books[0] = -1;
    scanf("%d %d", &N, &M);
    int readers[N];
    for (int i = 1; i <= N; ++i) {
        scanf("%d", &readers[i]);
        books[readers[i]]++;
    }
    for (int i = 1; i <= N; ++i) {
        int friends_num = books[readers[i]] - 1;
        if (friends_num == 0) {
            printf("BeiJu\n");
        } else {
            printf("%d\n", friends_num);
        }
    }
    return 0;
}

全部评论

相关推荐

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