[codeforces 1183F]Topforces Strikes Back

在即将举行的编程比赛中,作者需要从n个题目中选取不超过三个,要求这些题目的美观度之和最大,但条件是题目间的美观度不能相互整除。你的任务是为每个查询找出最大的美观度总和。采用剪枝策略的暴力搜索方法,通过排除因数关系和从大到小的选择顺序,可以得到最优解。
摘要由CSDN通过智能技术生成

time limit per test : 3 seconds
memory limit per test : 256 megabytes

分数:2400

One important contest will take place on the most famous programming platform (Topforces) very soon!
The authors have a pool of n n n problems and should choose at most three of them into this contest. The prettiness of the i-th problem is a i a_i ai. The authors have to compose the most pretty contest (in other words, the cumulative prettinesses of chosen problems should be maximum possible).

But there is one important thing in the contest preparation: because of some superstitions of authors, the prettinesses of problems cannot divide each other. In other words, if the prettinesses of chosen problems are x , y , z x,y,z x,y,z, then x x x should be divisible by neither y y y, nor z , y z, y z,y should be divisible by neither x x x, nor z z z and z z z should be divisible by neither x x x, nor y y y. If the prettinesses of chosen problems are x x x and

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值