4300: 绝世好题
来源:互联网 发布:pr文艺小清新调色数据 编辑:程序博客网 时间:2024/04/28 20:14
题目链接
题目大意:给定一个长度为n的数列ai,求ai的子序列bi的最长长度,满足bi&bi-1!=0(2<=i<=len)
考虑转移条件为
我的收获:
#include <iostream>#include <cstring>#include <cstdio>#include <cmath>#include <algorithm>using namespace std;int n,x,temp;int f[33];void work(){ int ret=0; for(int i=0;i<=30;i++) ret=max(ret,f[i]); printf("%d\n",ret);}void init(){ scanf("%d", &n); for(int i=1;i<=n;i++){ scanf("%d",&x);temp=0; for(int j=0;j<=30;j++) if(x&(1<<j)) temp=max(temp,f[j]+1); for(int j=0;j<=30;j++) if(x&(1<<j)) f[j]=max(f[j],temp); }}int main(){ init(); work(); return 0;}
阅读全文
0 0
- 4300: 绝世好题
- 4300: 绝世好题
- 【bzoj 4300】绝世好题
- 【BZOJ】4300 绝世好题
- BZOJ 4300: 绝世好题
- HYSBZ 4300 绝世好题
- BZOJ 4300 绝世好题
- 【bzoj 4300】绝世好题
- bzoj 4300: 绝世好题
- BZOJ 4300 绝世好题 递推
- BZOJ 4300 绝世好题 动态规划
- BZOJ 4300(绝世好题-dp)
- 【递推】BZOJ 4300:绝世好题
- [BZOJ 4300] 绝世好题 · 乱搞
- BZOJ 4300: 绝世好题【DP
- 【54.38%】【BZOJ 4300】绝世好题
- bzoj 4300 绝世好题(dp)
- BZOJ 4300 绝世好题(DP)
- C++11笔记
- jsp转发
- Android Tinker热更新Sample_demo接入
- Neo4j CQL -(16)- 合并
- Git分支提交代码到主干上
- 4300: 绝世好题
- Window Pains
- cJSON的简单应用(json对象、数组)
- CSS/JS 实现滑动页面,到一定位置,position 定位设置为fixed,否则用absolute;
- CreateToolhelp32Snapshot枚举进程(转) CreateToolhelp32Snapshot枚举进程 每一个应用程序实例在运行起来后都会在当前系统下产生一个进程,大多数应用程序均拥
- python查看import的目录
- 如何用git将项目代码上传到github
- 演讲稿
- netty4.x FixedChannelPool使用