标签: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; }
标签:while ace for row src using eof cto cstring
原文地址:http://www.cnblogs.com/FriskyPuppy/p/7458039.html