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 ...
随机推荐
- Centos7 yum install vim 出现“could not retrieve mirrorlist”
ps:来源 https://www.cnblogs.com/justphp/p/5959655.html 办法一:改dns解析 vim /etc/resolv.conf 添加: nameserver ...
- 内联/块级元素的宽高及margin/padding的说明 |||||| 为何img、input等内联元素可以设置宽、高
1,内联非替换元素设置宽高是无效的,设置margin时,左右有效,上下无效.设置padding时,左右有效,而上下padding比较奇葩,内联非替换元素的上下padding会在元素内容盒不动的情况下上 ...
- dj 分页器组件
django内置的分页器组件,能够帮我们实现对查询的数据进行自动分页,并返回分页对象 from django.core.paginator import Paginator, EmptyPage Pa ...
- jQuery length 和 size()区别
jQuery length和size()区别总结如下: 1.length是属性,size()是方法. 2.如果你只是想获取元素的个数,两者效果一样既 $("img").length ...
- asp.net下配置使用Memcached 如何使用Memcached .ne使用BeITMemcached.dllt配置Memcached的方法
首先在项目中引用 BeITMemcached.dll 在Web.config中配置节点 <configSections> <section name="beitmemcac ...
- LINQ 语法
语言集成查询 (LINQ) 是 Visual Studio 2008 和 .NET Framework 3.5 版中一项突破性的创新,它在对象领域和数据领域之间架起了一座桥梁. 传统上,针对数据的查询 ...
- crontab使用环境变量
两种方式: 1)直接在crontab中定义变量,如: A=123 * * * * * echo $A > /tmp/a.txt 注意在定义变量时不能使用$引用其它变量,如下面的做法错误: A=1 ...
- DynamicJson-好用dotnet4的json对象
最近看的书很杂,也深深被ES6的语法感动了,原来javascript可以这么好用.于是重新学习C#4.5.6,发现有一个dynamic就象是一个javascript对象,好玩!且有人写了一个json到 ...
- Django-配置、静态文件与路由
-----配置文件 1.BASE_DIR BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 2.DEBU ...
- 浮点型转整数型进行计算 - 移动GIS设备硬件的原因
在ArcGIS9.1之前桌面版ArcGIS都是采用整数存储的,是为了效率,将浮点型转为整数型存储,但9.2之后随着硬件的提升,浮点型的效率已经得到提高了,所以不再转换.但移动GIS设备还是要转整数型. ...