837D. Round Subset
来源:互联网 发布:ssh端口号是多少 编辑:程序博客网 时间:2024/06/06 23:15
http://codeforces.com/problemset/problem/837/D
#include<bits/stdc++.h>
using namespace std;
#define int long long
int dp[234][5200],n,k,tmp;
main()
{
memset(dp,-1,sizeof dp);
dp[0][0]=0;
cin>>n>>k;
for(int s=0; s<n; s++)
{
cin>>tmp;
int t=0,f=0;
while(tmp%2==0) t++,tmp/=2;
while(tmp%5==0) f++,tmp/=5;
for(int i=k-1; i>=0; i--)
for(int j=0; j<5200; j++)
if(dp[i][j]!=-1)
dp[i+1][j+f]=max(dp[i+1][j+f],dp[i][j]+t);//dp[][]表示2的个数
}
int ans=0;
for(int i=0; i<5200; i++) ans=max(ans,min(i,dp[k][i]));//5的个数和2的个数中最小的
cout<<ans<<endl;
}
阅读全文
0 0
- 837D. Round Subset
- Codeforces 837 D Round Subset
- Codeforces-837D Round Subset(dp)
- 【dp】codeforces 837D Round Subset
- codeforces 837D Round Subset (dp)
- Codeforces-837D:Round Subset(DP)
- Codeforces 837D Round Subset :随便来个DP
- Codeforces 837D Round Subset【思维+Dp+滚动数组】
- Educational Codeforces Round 26 D Round Subset
- Educational Codeforces Round 12 D. Simple Subset
- Educational Codeforces Round 12 D. Simple Subset
- cf Educational Codeforces Round 26 D. Round Subset
- Educational Codeforces Round 26 D. Round Subset 滚动数组优化DP
- 【DP】Codeforces837D. Round Subset
- CF837D-Round Subset
- 665D Simple Subset
- CodeForces 665D Simple Subset
- Codeforces 665D. Simple Subset
- 数组字符串那些经典算法:最大子序列和,最长递增子序列,最长公共子串,最长公共子序列,字符串编辑距离,最长不重复子串,最长回文子串
- Python中的数据类型
- clang及参数和生成中间代码
- vue-router 60分钟快速入门
- java+mybatis分表路由
- 837D. Round Subset
- 奥威数据分析软件Power-BI --员工销售表现分析
- Java版迪杰斯特拉算法
- Flume-NG源码阅读之Interceptor
- Xcode5~7 各个版本下载地址
- POJ 1218 THE DRUNK JAILER (题目虽然简单,但是学到了很多)
- hive 2.3.0配置与部署
- 反射第一步 : 创建Class 对象的三种方式,表示一个字节码对象。
- Spring Boot配置文件放在jar外部