You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
815 B

2 years ago
#include<bits/stdc++.h>//万能头
int n, a, b, c[34], d[8];//a数组代表小明彩票号码b数组代表中奖号码d数组代表中N等奖个数
//之所以开34个就想桶排的思想
using namespace std;
int main() {
cin >> n;
for (int i = 1; i <= 7; i++)//号码有7个
{
cin >> b;//输入中奖彩票号码
c[b] = 1;
}
for (int i = 1; i <= n; i++)//小明买了n张彩票
{
int sx = 0;
for (int j = 1; j <= 7; j++) {
cin >> a;//输入小明彩票号码
if (c[a] == 1)sx++;
}
d[7 - sx + 1]++;//中7-sx+1等奖的计数器+1
}
for (int i = 1; i <= 7; i++) {
cout << d[i] << " ";//输出数组 o(* ̄︶ ̄*)o
}
return 0;//不能忘 o(* ̄︶ ̄*)o
}