题面

 

    一道暴水的dp。。。。别问我为什么直接打开了G题,我只是对题目名称感兴趣而已。。。。

#include<bits/stdc++.h>
#define ll long long
using namespace std;

inline int read(){
    int x=0; char ch=getchar();
    for(;!isdigit(ch);ch=getchar());
    for(;isdigit(ch);ch=getchar()) x=x*10+ch-'0';
    return x;
}

ll f[37];
int n,c[5];

int main(){
	n=read();
	
	for(int i=1;i<=n;i++){
		for(int j=0;j<5;j++) c[j]=read();
		
		for(int k=30,u;k>=0;k--)
		    for(int j=0;j<5;j++){
		    	u=k|(1<<j);
		    	if(u>k) f[u]=max(f[u],f[k]+c[j]);
			}
	}
	
	cout<<f[31]<<endl;
	return 0;
}

  

相关文章:

  • 2021-10-09
  • 2021-11-26
  • 2021-06-11
  • 2022-03-06
  • 2021-10-24
  • 2021-05-22
  • 2021-08-07
  • 2021-09-13
猜你喜欢
  • 2021-06-24
  • 2022-03-03
  • 2021-08-01
  • 2021-07-14
  • 2022-12-23
  • 2021-08-08
  • 2021-12-02
相关资源
相似解决方案