求助……自己找不出来错误了……
查看原帖
求助……自己找不出来错误了……
399150
Shunpower楼主2020/12/22 13:29

DALAO们救救我!

本萌新实在不解为何过不了样例……遂发布此贴望求解……

#include <bits/stdc++.h>
using namespace std;
int main(){
int a[7],n,b,cnt=0;
cin>>n;
int c[7];
for(int i=0;i<7;i++){
a[i]=0;
c[i]=0;
cin>>a[i];

}
for(int p=0;p<n*7;p++){
cin>>b;
for(int t=0;t<7;t++){
if(a[t]==b){
cnt++;
}}


if(cnt==7){
c[0]++;
}

if(cnt==6){
c[1]++;
}
if(cnt==5){
c[2]++;
}
if(cnt==4){
c[3]++;
}
if(cnt==3){
c[4]++;
}
if(cnt==2){
c[5]++;
}
if(cnt==1){
c[6]++;
}
cnt=0;
}
for(int s=0;s<6;s++){
cout<<c[s]<<" ";
}
cout<<c[6]<<endl;
return 0;
}

请教DALAO!

2020/12/22 13:29
加载中...