傳送門
4
1 2 10 1
14 36 30 8
題目大意:
給定
解題思路:
首先將每個數的2進制求出來,在每位2進制數中求出
每次選奇數個
奇數個
次冪,
是任意
/**
2016 - 09 - 20 晚上
Author: ITAK
Motto:
本日的我要超出昨日的我,明日的我要勝過本日的我,
以創作出更好的代碼為目標,不斷地超出自己。
**/
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <queue>
#include <algorithm>
#include <set>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
const int INF = 1e9+5;
const int MAXN = 1e3+5;
const int MOD = 1e6+3;
const double eps = 1e⑺;
const double PI = acos(-1);
using namespace std;
int Scan_Int()///輸入外掛
{
int res = 0, ch, flag = 0;
if((ch=getchar()) == '-')
flag = 1;
else if(ch >= '0' && ch<='9')
res = ch-'0';
while((ch=getchar())>='0' && ch<='9')
res = res*10+ch-'0';
return flag?-res:res;
}
LL Scan_LL()///輸入外掛
{
LL res=0,ch,flag=0;
if((ch=getchar())=='-')
flag=1;
else if(ch>='0'&&ch<='9')
res=ch-'0';
while((ch=getchar())>='0'&&ch<='9')
res=res*10+ch-'0';
return flag?-res:res;
}
void Out(int a)///輸出外掛
{
if(a>9)
Out(a/10);
putchar(a%10+'0');
}
LL c[MAXN][MAXN];
void Init()
{
c[0][0] = 1;
for(int i=1; i<MAXN; i++)
c[i][0] = 1;
for(int i=1; i<MAXN; i++)
for(int j=1; j<MAXN; j++)
c[i][j] = (c[i-1][j-1] + c[i-1][j]) % MOD;
}
LL a[MAXN];
int cnt[70];
int main()
{
Init();
int n;
while(~scanf("%d",&n))
{
for(int i=0; i<n; i++)
scanf("%I64d",&a[i]);
memset(cnt, 0, sizeof(cnt));
for(int i=0; i<n; i++)
{
LL tp = a[i];
for(int j=0; j<63; j++)
{
if(tp & 1)
cnt[j]++;
tp>>=1;
}
}
for(int i=1; i<=n; i++)
{
LL sum = 0;
for(int j=0; j<63; j++)
{
if(cnt[j])
{
for(int k=1; k<=i; k+=2)
{
if(cnt[j]>=k && (n-cnt[j]>=i-k))
{
sum += ((c[cnt[j]][k]*c[(n-cnt[j])][i-k]%MOD)*(1LL<<j)%MOD);
sum %= MOD;
}
}
}
}
if(i != n)
cout<<sum<<" ";
else
cout<<sum<<endl;
}
}
return 0;
}