Cod sursa(job #1913154)

Utilizator andytosaAndrei Tosa andytosa Data 8 martie 2017 11:56:31
Problema Arbore partial de cost minim Scor 0
Compilator cpp Status done
Runda Arhiva educationala Marime 0.47 kb
#include <fstream>

using namespace std;
ifstream fin("and.in");
ofstream fout("and.out");

int n, x, maxi, v[50];
int main()
{
    fin >> n;
    for(int i = 1; i <= n; ++i){
        fin >> x;
        for(int j = 0; (1LL << j) <= x; ++j){
            if(x & (1LL << j)){
                v[j]++;
                maxi = max(maxi, v[j]);
            }
            else {
                v[j] = 0;
            }
        }
    }
    fout << maxi;
    return 0;
}