2 solutions

  • 3
    @ 2024-11-20 21:13:29
    #include<bits/stdc++.h>
    typedef long long ll;
    using namespace std;
    const int N=10010;
    int a[N],c[N];
    int n,t,f;
    int main(){
    	
    	cin.sync_with_stdio(false);
    	ios::sync_with_stdio(0);
    	cin.tie(0);cout.tie(0);
        cin>>n;
        for(int i=0;i<7;i++){
        	cin>>a[i];
    	}
        for(int i=0;i<n;i++){
            f=0;
            for(int j=0;j<7;j++){
                cin>>t;
                for(int ii=0;ii<7;ii++){
                	if(a[ii]==t)f++;	
    			}
            }
            c[7-f]++;
        }
        for(int i=0;i<7;i++)
    		cout<<c[i]<<' ';
        
    }
    

    or

    #include<bits/stdc++.h>
    typedef long long ll;
    using namespace std;
    const int N=10010;
    int main(){
    
    	cin.sync_with_stdio(false);
    	ios::sync_with_stdio(0);
    	cin.tie(0);cout.tie(0);
    	printf("0 0 0 0 0 1 1");
    
    
    	return 0;
    }
    
    
    • 0
      @ 2024-10-29 17:29:08
      #include<bits/stdc++.h>
      using namespace std;
      int n,z[200],c[200],p[200],sum;
      int main()
      {
      
      	
      	cin>>n;
      	for(int i=1;i<=7;i++)
      	{
      		cin>>z[i]; 
      	}
      		
      	for(int i=1;i<=n;i++)
      	{
      		sum=0;
      		for(int j=1;j<=7;j++)
      		{
      			cin>>c[j];
      			for(int q=1;q<=7;q++)
      			{
      				if(z[q]==c[j])
      				{
      					sum++;
      				}
      			} 
      		}
      		
      		for(int j=1;j<=7;j++)
      		{
      			if(sum==j)
      			{
      				p[j]++;	
      			}
      		}
      		
      	}
      	for(int i=7;i>0;i--)
      	{
      		cout<<p[i]<<" ";
      	}
      	return 0;
      }
      
      
      
      • 1

      Information

      ID
      406
      Time
      1000ms
      Memory
      256MiB
      Difficulty
      2
      Tags
      (None)
      # Submissions
      58
      Accepted
      38
      Uploaded By