zoukankan      html  css  js  c++  java
  • 杭电多校2020-2 Lead of Wisdom

    http://acm.hdu.edu.cn/showproblem.php?pid=6772

    题意:

    n件物品,每种物品有一个种类ti
    四个属性 ai , bi , ci , di
    每个种类最多选一件物品,求 四个属性分别求和 再与100相加 最后 乘积

    思路:

    DFS 种类i物品数量不超过50 跳过没有的种类

    (没过

    #include<iostream>
    #include<cstdio>
    #include<cstring>
    #include<algorithm>
    #include<bitset>
    #include<cassert>
    #include<cctype>
    #include<cmath>
    #include<cstdlib>
    #include<ctime>
    #include<deque>
    #include<iomanip>
    #include<list>
    #include<map>
    #include<queue>
    #include<set>
    #include<stack>
    #include<vector>
    #include <vector>
    #include <iterator>
    #include <utility>
    #include <sstream>
    #include <limits>
    #include <numeric>
    #include <functional>
    using namespace std;
    #define gc getchar()
    #define mem(a) memset(a,0,sizeof(a))
    //#define sort(a,n,int) sort(a,a+n,less<int>())
    
    #define ios ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    
    typedef long long ll;
    typedef unsigned long long ull;
    typedef long double ld;
    typedef pair<int,int> pii;
    typedef char ch;
    typedef double db;
    
    const double PI=acos(-1.0);
    const double eps=1e-6;
    const int inf=0x3f3f3f3f;
    const int maxn=1e5+10;
    const int maxm=100+10;
    const int N=2e5+10;
    const int mod=1e9+7;
    
    int Len = 51;
    struct item{
    	int a = 0;
    	int b = 0;
    	int c = 0;
    	int d = 0;
    }s[N][N];
    
    ll ans[N],nxt[N];
    int main(){
    	int sum = 0;
    	int T = 0;
    	int n = 0 , k = 0;
    	cin >> T;
    	while(T--){
    		sum = 0;
            memset(ans , 0 , sizeof(ans));
            cin >> n >> k;
            for (int i = 0;i<n;i++){
                int t , q , w , e , r;
                cin >> t >> q >> w >> e >> r;
                s[t][ans[t]].a = q;
    			s[t][ans[t]].b = w;
    			s[t][ans[t]].c = e;
    			s[t][ans[t]].d=r;
                ans[t]++;
            }
            int x=k+1;
            for(int i=k;i;i--){
                nxt[i]=x;
                if(ans[i])x=i;
            }
    
    		int p = 1;
    		int a , b , c , d;
    		a = b = c = d = 0;
    		int s1 = 0;
            for(int i = 0;i < ans[p] || ans[p] == 0;i++)
            {
        	 	if(k+1 == p)
        		{
            		ll s = (a+100)*(b+100)*(c+100)*(d+100);
            		if(s > s1)
    				{
    					s1 = s;
    				}
            		return 0;
        		}
            	p += 1;
    			a += s[p][i].a;
    			b += s[p][i].b;
    			c += s[p][i].c;
    			d += s[p][i].d;
    		}
            cout << sum;
    	}
    }
    

      

    作者:YukiRinLL

    出处:YukiRinLL的博客--https://www.cnblogs.com/SutsuharaYuki/

    您的支持是对博主最大的鼓励,感谢您的认真阅读。

    本文版权归作者所有,欢迎转载,但请保留该声明。

  • 相关阅读:
    Jquery 取值,赋值学习总结
    JQuery 常用代码
    Spring Boot JPA
    QueryDSL通用查询框架学习目录
    正确理解MySQL中的where和having的区别
    spring jpa 带参数分页查询(一)
    mysql在表的某一位置增加一列、删除一列、修改列名
    Spring AOP注解配置demo
    java 分页对象以及数据库分页查询
    ztree点击加号+触发ajax请求
  • 原文地址:https://www.cnblogs.com/SutsuharaYuki/p/13388788.html
Copyright © 2011-2022 走看看