题目很简单。

给你n个数,输出n个答案,第i个答案表示从n个数里取遍i个数的异或值的和。

其实每一个数最多也就32位,把所有的数分解,保存每一位总共有多少个1,最后要是这一位的异或结果为1,那么在所有的异或数中,这一位为1的数必须是有奇数个,在求解的时候就是求组合数的情况就可以了。

直接水过。

#include <iostream>
#include <cstdio>
#include <cstring>
#define M 1000003
#define maxn 1005
typedef long long ll;
using namespace std; int a[];
int ans,n,m,k,c[maxn][maxn],u[];
ll tep; void insert(int x)
{
for (int cur=; x; cur++,x>>=) a[cur]+=x&;
} void init_c()
{
u[]=;
for (int i=; i<=; i++) u[i]=(u[i-]+u[i-])%M;
c[][]=;
c[][]=c[][]=;
for (int i=; i<maxn; i++)
{
c[i][]=;
for (int j=; j<=i; j++)
c[i][j]=(c[i-][j]+c[i-][j-])%M;
}
} int main()
{
init_c();
while (scanf("%d",&n)!=EOF)
{
memset(a,,sizeof a);
for (int i=; i<=n; i++) scanf("%d",&k),insert(k);
for (int i=; i<=n; i++)
{
ans=;
for (int j=; j<=; j++)//每一位为1的情况
{
for (k=; k<=a[j] && k<=i; k+=)
{
if (i-k>n-a[j]) continue;
tep=(ll)c[a[j]][k]*c[n-a[j]][i-k];
tep%=M;
tep=(tep*u[j])%M;
ans+=tep;
if (ans>=M) ans-=M;
}
}
if (i>) printf(" ");
printf("%d",ans);
}
printf("\n");
}
return ;
}

HDU4810_Wall Painting的更多相关文章

  1. CF448C Painting Fence (分治递归)

    Codeforces Round #256 (Div. 2) C C. Painting Fence time limit per test 1 second memory limit per tes ...

  2. [译]使用Continuous painting mode来分析页面的绘制状态

    Chrome Canary(Chrome “金丝雀版本”)目前已经支持Continuous painting mode,用于分析页面性能.这篇文章将会介绍怎么才能页面在绘制过程中找到问题和怎么利用这个 ...

  3. Codeforces Round #353 (Div. 2)Restoring Painting

    Vasya works as a watchman in the gallery. Unfortunately, one of the most expensive paintings was sto ...

  4. hdu-4810 Wall Painting(组合数学)

    题目链接: Wall Painting Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Oth ...

  5. Codeforces Gym 100342C Problem C. Painting Cottages 转化题意

    Problem C. Painting CottagesTime Limit: 2 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/10 ...

  6. F面经:painting house

    There are a row of houses, each house can be painted with three colors red, blue and green. The cost ...

  7. HDU 3685 Rotational Painting(多边形质心+凸包)(2010 Asia Hangzhou Regional Contest)

    Problem Description Josh Lyman is a gifted painter. One of his great works is a glass painting. He c ...

  8. HDU 4810 Wall Painting

    Wall Painting Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)To ...

  9. UVA 253 Cube painting(暴力打表)

    Cube painting Problem Description: We have a machine for painting cubes. It is supplied with three d ...

随机推荐

  1. 20155233 《Java程序设计》实验四 Android开发基础

    20155233 <Java程序设计>实验四 Android开发基础 实验内容 1.基于Android Studio开发简单的Android应用并部署测试; 2.了解Android组件.布 ...

  2. Potree学习总结

    一.      简介 基于Web端的三维模型展示,这里仅介绍Three.js和Potree. Three.js 是一款基于WebGL的运行在浏览器中的 3D 开源引擎,用它创建各种三维场景.它类似于M ...

  3. day6 网络 HTML模板

    1.HTML模板 HTML模板 baidu一下 http://www.cssmoban.com/ http://www.cnblogs.com/web-d/archive/2010/04/16/171 ...

  4. JS基础,课堂作业,健康体重评估

    健康体重评估 <script> var sex = prompt("请输入性别:"); var height = parseInt(prompt("请输入身高 ...

  5. Redash二次开发-开发环境搭建

    环境:win7+pycharm 2018.2 +redash 1.安装pycharm并如何正常使用,找度娘. 2.配置pycharm vcs,设置github用户,从github新建redash项目 ...

  6. 内容安全策略(CSP)

    内容安全策略(CSP),其核心思想十分简单:网站通过发送一个 CSP 头部,来告诉浏览器什么是被授权执行的与什么是需要被禁止的.其被誉为专门为解决XSS攻击而生的神器. 1.CSP是什么 CSP指的是 ...

  7. Spring Cloud(三):服务提供与调用 Eureka【Finchley 版】

    Spring Cloud(三):服务提供与调用 Eureka[Finchley 版]  发表于 2018-04-15 |  更新于 2018-05-07 |  上一篇文章我们介绍了 Eureka 服务 ...

  8. ConcurrentHashMap(JDK1.8)为什么要放弃Segment

    今天看到一篇博客:jdk1.8的HashMap和ConcurrentHashMap,我想起了前段时间面试的一个问题:ConcurrentHashMap(JDK1.8)为什么要使用synchronize ...

  9. 『ACM C++』PTA浙大 | 基础题 - Have Fun with Numbers

    连着这两道都是开学前数构老师的“爱心作业”,还没上课开学就给我们布置作业了,这道题有点小坑,也经常遇到类似的问题,特地拿出来记录一下. -------------------------------- ...

  10. [C++] Solve "Launch Failed. Binary not found." error on Eclipse

    This error is that the default lanch configuration is not being created for this project. To solve i ...