POJ 2453
#include <iostream>
#include <algorithm>
#include <cmath>
#define MAXN 1000
#define M_15 15
using namespace std; int _b[M_15];
struct node
{
int tot;
int v;
int d[];
node()
{
v = ;
tot = ;
}
}; void fun_3();
node _[MAXN];
int fun_2(int sum);
int fun_1(int d,int k);
int n;
int d;
int main()
{
//freopen("acm.acm","r",stdin); int k;
int i;
int j;
int p;
int tem;
cin>>n;
cin>>d;
cin>>k; for(i = ; i < n; ++ i)
{
cin>>_[i].tot;
for(j = ; j < _[i].tot; ++ j)
{
//cin>>_[i].d[j];
cin>>tem;
_[i].d[tem-] = ;
}
}
fun_3();
cout<<fun_1(d,k)<<endl;
} int fun_1(int d,int k)
{
int i;
int j;
int sum;
int max = -;
for(i = ; i < k; ++ i)
{
_b[i] = ;
}
sort(_b,_b+d);
sum = ;
int tem = ;
for(i = d-; i >= ; -- i)
{
sum += _b[i]*pow((double),tem);
++ tem;
}
// cout<<sum<<endl;
if((tem = fun_2(sum) ) > max)
{
max = tem;
}
// cout<<tem<<endl;
while(next_permutation(_b,_b+d))
{
sum = ;
int tem = ;
for(i = d-; i >= ; -- i)
{
sum += _b[i]*pow((double),tem);
++ tem;
}
// cout<<sum<<endl;
tem = fun_2(sum);
// cout<<tem<<endl;
if(tem > max)
{
max = tem;
}
}
return max; } int fun_2(int sum)
{
int i;
int j;
int t = ;
for(i = ; i < n; ++ i)
{
if(sum == (sum|_[i].v) )
{
++ t;
}
// cout<<sum<<"_"<<_[i].v<<endl;
}
// cout<<"000000000000000000000————————"<<t<<endl;
return t;
} void fun_3()
{
int tem = ;
int i;
int j;
for(i = ; i < n; ++ i)
{
tem = ;
for(j = d-; j >= ; -- j)
{
_[i].v += _[i].d[j]*pow((double),tem);
++ tem;
}
// cout<<_[i].v<<endl;
// cout<<" d "<<d<<endl;
}
}
POJ 2453的更多相关文章
- [POJ] 2453 An Easy Problem [位运算]
An Easy Problem Description As we known, data stored in the computers is in binary form. The probl ...
- [poj 2453] An Easy Problem
An Easy Problem Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 8371 Accepted: 5009 D ...
- 模板:统计1~n内x的个数
http://noi.openjudge.cn/ch0105/40/ 40:数1的个数-拓展变形 查看 提交 统计 提问 总时间限制: 1000ms 内存限制: 65536kB 描述 给定一个十进 ...
- POJ 3370. Halloween treats 抽屉原理 / 鸽巢原理
Halloween treats Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 7644 Accepted: 2798 ...
- POJ 2356. Find a multiple 抽屉原理 / 鸽巢原理
Find a multiple Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 7192 Accepted: 3138 ...
- POJ 2965. The Pilots Brothers' refrigerator 枚举or爆搜or分治
The Pilots Brothers' refrigerator Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 22286 ...
- POJ 1753. Flip Game 枚举or爆搜+位压缩,或者高斯消元法
Flip Game Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 37427 Accepted: 16288 Descr ...
- POJ 3254. Corn Fields 状态压缩DP (入门级)
Corn Fields Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 9806 Accepted: 5185 Descr ...
- POJ 2739. Sum of Consecutive Prime Numbers
Sum of Consecutive Prime Numbers Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 20050 ...
随机推荐
- 2018.11.06 bzoj2287: 【POJ Challenge】消失之物(背包)
传送门 先假设所有物品都能用,做01背包求出方案数. 然后枚举每个点,分类讨论扣掉它对答案的贡献. 代码: #include<bits/stdc++.h> using namespace ...
- IBM X3650 M3/M4的服务器装系统
IBM X3650 M3/M4的服务器一般都有两块以上的硬盘.所以如果没有做RAID,那首先应该做好raid 磁盘阵列.本文装系统的前提是RAID已经做好. 一般安装系统的方式为先在IBM官网下载对应 ...
- Opencv(3):基本数据类型
1.比较简单的原子类型 结构 成员 意义 CvPoint int x,y 图像中的点 CvPoint2D32f float x,y 二维空间中的点 CvPoint3D32f float x,y,z 三 ...
- Vbs脚本简单使用
之前在做项目时用到了一点vbs脚本,记录下. C++程序调用vbs脚本 System(vbs路径 参数); //空格隔开 Vbs脚本 '''''Vbs脚本解析参数 Set objArgs = Wscr ...
- string流
istringstream和ostringstream 从istringstream类中读取数据赋值给某个string,写入某个string到ostringstream类,头文件<sstream ...
- Mybatis-Plus 实战完整学习笔记(八)------delete测试
1.根据ID删除一个员工deleteById /** * 删除客户 * * @throws SQLException */ @Test public void deletedMethod() thro ...
- Typecho 独立页面 添加自定义模板
1.首先在主题文件夹新建一个 ***.php 文件 编写代码 <?php /** * _主题命名 * * @package custom * */$this->need('header.p ...
- REST WebService与SOAP WebService的比较
在SOA的基础技术实现方式中WebService占据了很重要的地位,通常我们提到WebService第一想法就是SOAP消息在各种传输协议上交互.近几年REST的思想伴随着SOA逐渐被大家接受,同时各 ...
- 阿里云存储oss+怎么上传找文件夹
最近公司做工程项目,实现文件夹云存储上传. 网上找了很久,发现网上很多项目都存在相似问题,最后终于找到了一个符合我要求的项目. 工程如下: 这里对项目的文件夹云存储上传进行分析,实现文件夹上传,如何进 ...
- (最大m子段和) Max Sum Plus Plus (Hdu 1024)
http://acm.hdu.edu.cn/showproblem.php?pid=1024 Max Sum Plus Plus Time Limit: 2000/1000 MS (Java/ ...