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

谁是你的潜在朋友

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

#include <iostream>
#include <cstdio>
#include <string>
using namespace std;
const int MAX=200;
int books[MAX];
int bookNum[MAX];

int main() {
    int N,M;
    while(scanf("%d %d",&N,&M)!=EOF){
        for(int i=1;i<=M;i++){
            books[i]=-1;
        }
        
        for(int i=1;i<=N;i++){
            scanf("%d",&bookNum[i]);
            books[bookNum[i]]++;
        }
        for(int i=1;i<=N;i++){
            if(books[bookNum[i]]<=0){
                printf("BeiJu\n");
            }else{
                printf("%d\n",books[bookNum[i]]);
            }
        }
    }
    return 0;
}
// 64 位输出请用 printf("%lld")

全部评论

相关推荐

陆续:不可思议 竟然没那就话 那就我来吧 :你是我在牛客见到的最美的女孩
点赞 评论 收藏
分享
程序员小白条:找的太晚,别人都是大三实习,然后大四秋招春招的,你大四下了才去实习,晚1年
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务