Skip to content

Instantly share code, notes, and snippets.

@haroldxin
Created September 20, 2014 04:12
Show Gist options
  • Save haroldxin/f074a59b9c8d6bc5e04c to your computer and use it in GitHub Desktop.
Save haroldxin/f074a59b9c8d6bc5e04c to your computer and use it in GitHub Desktop.
Lottery!
#include <iostream>
#include <cstdio>
using namespace std;
int main(){
freopen("lottery.in","r",stdin);
freopen("lottery.out","w",stdout);
int n;
cin >> n;
int caipiao[8];
for (int i=1;i<=7;i++)scanf("%d",&caipiao[i]);
int buy[n+1][8];
for (int i=1;i<=n;i++){
for(int j=1;j<=7;j++){
scanf("%d",&buy[i][j]);
}
}
int count[n+1];
for(int i=1;i<=n;i++)count[i]=0;
for(int i=1;i<=7;i++){
for(int j=1;j<=n;j++){//第J行
for(int k=1;k<=7;k++){//第几个
if(buy[j][k]==caipiao[i])count[j]=count[j]+1;
}
}
}
int no1=0,one=0,two=0,thr=0,fou=0,five=0,six=0;
for (int i=1;i<=n;i++){
if(count[i]==7)no1=no1+1;
if(count[i]==6)one=one+1;
if(count[i]==5)two=two+1;
if(count[i]==4)thr=thr+1;
if(count[i]==3)fou=fou+1;
if(count[i]==2)five=five+1;
if(count[i]==1)six=six+1;
}
printf("%d %d %d %d %d %d %d",no1,one,two,thr,fou,five,six);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment