KY29谁是你的潜在朋友
谁是你的潜在朋友
http://www.nowcoder.com/questionTerminal/0177394fb25b42b48657bc2b1c6f9fcc
#include<iostream> #include<algorithm> using namespace std; int main(){ int N,M; cin>>N; cin>>M; int book[M]; int ram[100]; for(int i=0;i<M;i++){ book[i]=0; } for(int i=0;i<N;i++){ cin>>ram[i]; int b=ram[i]; book[b]=book[b]+1; } for(int i=0;i<N;i++){ int d=ram[i]; if(book[d]==1){ cout<<"BeiJu"<<endl; } else{ cout<<book[d]-1<<endl; } } }