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 ...
随机推荐
- 走进JDK(三)------AbstractStringBuilder、StringBuffer、StringBuilder
AbstractStringBuilder是一个抽象类,StringBuffer.StringBuilder则继承AbstractStringBuilder,所以先说AbstractStringBui ...
- Java之spilt()函数,trim()函数
一.单个符号作为分隔符 package com.regix; public class FuncSpilt { public static void main(String[] args) { // ...
- nginx location配置和rewrite写法
location = / { # 精确匹配 / ,主机名后面不能带任何字符串 [ configuration A ] } location / { # 因为所有的地址都以 / 开头,所以这条规则将匹配 ...
- python 基础1
一.python版本的介绍 python有两个大的版本2.X与3.X的版本,而在不久的将来将全面的进入3的版本.3的版本将比2的版本功能更加强大,而且也修复了大量的bug. 二.python的安装可以 ...
- mac终端的命令都失效的解决方法
step1. 在terminal里面输入: export PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin&qu ...
- linux下如何编写shell脚本
我对shell脚本的认识,除了执行过同事写的shell 脚本外,其他一无所知,为了让自己强大,我决定自己研究shell脚本,也许在你看来很简答,没必要说这么多废话,但是我希望在我的技术log里记录下来 ...
- java基础-day19
第08天 异常 今日内容介绍 u 异常体系&异常处理 u Throwable常用方法&自定义异常 u 递归 第1章 异常产生&异常处理 1.1 异常概述 什 ...
- 谷歌的java文本差异对比工具
package com.huawei.common.transfertool.utils; /** * @author Paul * @version 0.1 * @date 2018/12/11 * ...
- hive的 order by & distribute by & cluter by
我们应该都清楚order by 的含义: 根据某个字段对输出的数据排序,因为只有一个reducer,所以查询效率较慢. 那么hive中,另外两个排序,distribute by和cluster by的 ...
- JMS学习以及jms的实现activeMq
1.JMS规范介绍: http://www.cnblogs.com/hapjin/p/5431706.html http://elim.iteye.com/blog/1893038 http://bl ...