Files
python/LuoGu/RuMen/P2550.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

28 lines
815 B
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#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
}