467B Codeforces - Fedor and new game


467B codeforces 


Fedor and new game

Solution in c++

#include <iostream>

using namespace std;

int main()

{
    int n,m,k,sol,solv=0,tr;

    cin>>n>>m>>k;

    int nn[m+1];

   for(int o=0;o<=m;o++)cin>>nn[o];

   int trr=nn[m];

   for(int o=0;o<m;o++){

        int trrr=nn[o];

        sol=0;

        for(int i=31;i>=0;i--){

            int p1=0;

            if(trrr&(1<<i)){p1++;}

            if(trr&(1<<i)){p1++;}

            if(p1==1)sol++;

        }

       if(sol<=k)solv++;

   }

    cout<<solv<<"\n";

    return 0;

}

Share on Google Plus

About Mohamed Sobhi

My name is Mo.Sobhy ,I study at School excelling high school in Ain Shams ,Cairo
My hobbies is programming ,and web development ,playing chess and writing horror stories.
    Blogger Comment
    Facebook Comment

0 التعليقات:

إرسال تعليق