码迷,mamicode.com
首页 > 其他好文 > 详细

HDU

时间:2017-08-31 16:00:19      阅读:138      评论:0      收藏:0      [点我收藏+]

标签:while   ace   for   row   src   using   eof   cto   cstring   

  

技术分享
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <cstring>
#include <iterator>
#include <cmath>
#include <algorithm>
#include <stack>
#include <deque>
#include <map>
#define lson l, m, rt<<1
#define rson m+1, r, rt<<1|1
#define mem0(a) memset(a,0,sizeof(a))
#define sca(x) scanf("%d",&x)
#define de printf("=======\n")
typedef long long ll;
using namespace std;

const int maxn = 1e5+10;
int a[maxn][32];
int cnt1[32];
int cnt0[32];

void turn(int row, int num) {
    int cnt = 0;
    while( num ) {
        a[row][cnt++] = num % 2;
        num /= 2;
    }
}
int main() {
    int n, q;
    while( scanf( "%d%d", &n, &q ) == 2 ) {
        mem0(a);
        mem0(cnt1);
        mem0(cnt0);
        int tand, tor, txor;
        for( int i = 0; i < n; i++ ) {
            int num;
            sca(num);
            if( i == 0 ) {
                tand = tor = txor = num;
            }
            else {
                
            }
            turn(i, num);
            
        }
//        for( int i = 0; i <= 30; i++ ) {
//            for( int j = 0; j <= 30; j++ ) {
//                cout << a[i][j] << " ";
//            }
//            cout << endl;
//        }
        for( int i = 0; i < 32; i++ ) {
            for( int j = 0; j < n; j++ ) {
                if( a[j][i] ) cnt1[i]++;
                else cnt0[i]++;
            }
        }
//        for( int i = 0; i < 10; i++ ) {
//            de;
//            cout << cnt1[i] << endl;
//            cout << cnt0[i] << endl;
//        }
        for( int i = 0; i < 30; i++ ) {
            
        }
    }
    return 0;
}
View Code

 

HDU

标签:while   ace   for   row   src   using   eof   cto   cstring   

原文地址:http://www.cnblogs.com/FriskyPuppy/p/7458039.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!