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 ...
随机推荐
- Java核心技术之类与对象
知识点 1. 一个对象变量并没有实际包含一个对象,而仅仅引用一个对象.new操作符的返回值也是一个引用. 2. 局部变量不会自动地初始化为null,而必须用过调用new或将他们设置为null进行初始化 ...
- python模块:re
# # Secret Labs' Regular Expression Engine # # re-compatible interface for the sre matching engine # ...
- IntelliJ IDEA 2017版 spring-boot 2.0.3 部署war包项目和jar包项目
1.建立项目 Java Controller package com.springboot.jsp.controller; import org.springframework.stereotype. ...
- jquery取消事件冒泡的三种方法展示
jquery取消事件冒泡的三种方法展示 html代码 <!doctype html> <html> <head> <meta charset="ut ...
- 一些js在线引用文档
1.jquery在线引用: <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script& ...
- Codeforces Round #540 (Div. 3)--1118F1 - Tree Cutting (Easy Version)
https://codeforces.com/contest/1118/problem/F1 #include<bits/stdc++.h> using namespace std; in ...
- 最短路 模板 【bellman-ford,dijkstra,floyd-warshall】
Bellman-ford: /* bellman ford */ #include <iostream> #include <cstdio> #include <cstr ...
- lowbit(x)
int Lowbit(int x) { return x&(-x); } lowbit当中x,-x,补码,反码,傻傻分不清楚.我们先看看两个二进制数相减的问题 两个二进制数相减的相关问题 两个 ...
- 【转】利用线程更新ListView (2014-09-28 08:25:20)
http://blog.sina.com.cn/s/blog_44fa172f0102v2x0.html procedure TForm5.Button3Click(Sender: TObject); ...
- Android-Kotlin-set/get方法的使用
Student.kt package cn.kotlin.kotlin_oop04 open class Person { open var personName:String = "我是父 ...