题目很简单。

给你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. Win10系统下VirtualBox虚拟机初体验

    在接触本次的VirtualBox之前,我在大一下学期参加李冬冬老师的选修课中学习过VMware,并使用VMware进行过一些计算机病毒之类的实验.但是,使用虚拟机模拟其他不同操作系统这次是第一次,因此 ...

  2. 2016-2017-20155329 《Java程序设计》第十周学习总结

    学号 2016-2017-20155329 <Java程序设计>第十周学习总结 教材学习内容总结 学习目标 了解计算机网络基础 OSI分层(7层):物理层.数据链路层.网络层.传输层.会话 ...

  3. 20155331 2016-2017-2《Java程序设计》课程总结

    20155331 2016-2017-2<Java程序设计>课程总结 每周作业 预备作业1:新学期,新展望 预备作业2:游戏经验 第一周学习总结:大致浏览教材并提出问题 第二周学习总结:基 ...

  4. win10-MySql免安装版-安装/多实例

    一.MySql免安装版安装: 1.MySql分为两个版本: 安装板的msi格式文件,直接点击下一步,下一步就可以安装 免安装版的zip格式,直接解压配置安装即可,[解压-初始化创建data目录-创建用 ...

  5. 对PostgreSQL数据库的hstore类型建立GisT索引的实验

    磨砺技术珠矶,践行数据之道,追求卓越价值回到上一级页面:PostgreSQL基础知识与基本操作索引页    回到顶级页面:PostgreSQL索引页[作者 高健@博客园  luckyjackgao@g ...

  6. [agc006E]Rotate 3x3

    Description 给你一个3*N的网格,位置为(i,j)的网格上的数为i+3(j-1).每次选一个3*3的网格旋转180度,问最后能否使得网格(i,j)的值为ai,j.(5≤N≤105) 如图: ...

  7. 解析hdr图像文件的python实现

    如题 import cv2 import numpy as np def rgbe2float(rgbe): res = np.zeros((rgbe.shape[0],rgbe.shape[1],3 ...

  8. js 零零散散的总结。

    Array.slice.call(arguments);可以将一个类数组转化为数组. Array.from() ,[...arr];也可以将一个类数组转化为数组(es6). (function() { ...

  9. PHP开发中常见的漏洞及防范

    PHP开发中常见的漏洞及防范 对于PHP的漏洞,目前常见的漏洞有五种.分别是Session文件漏洞.SQL注入漏洞.脚本命令执行漏洞.全局变量漏洞和文件漏洞.这里分别对这些漏洞进行简要的介绍和防范. ...

  10. LNMP环境+ 前后端项目部署+redis+redis扩展

    LNMP 环境    (参照https://lnmp.org/install.html) wget -c http://soft.vpser.net/lnmp/lnmp1.4.tar.gz & ...