第 45 届国际大学生程序设计竞赛(ICPC)亚洲区域赛(济南)C-Stone Game

博客围绕石头堆合并问题展开,给定不同石头数量的石堆,每次合并两堆费用为(x%3)*(y%3),目标是最小化将所有石堆合并成一堆的费用。思路是忽略三个一堆的石堆,优先合并1和2,处理剩余石堆,最后给出解题思路但未展示完整代码。

题目

题目描述
MianKing has nn piles of stones and each pile has at most 3 stones, now he wants to merge all of these stones into one pile.

In order to achieve his goal, each time MianKing can choose two piles of stones and merge them into a new pile, and the number of stones in the new pile is the sum of these two piles.

Because it takes manpower to move stones, in each operation if the numbers of these two piles of stones are xx and yy respectively, MianKing should pay(x mod 3)(y mod 3)(x~mod~3)(y~mod~3)(x mod 3)(y mod 3)coins for it.

Now MianKing wants to know the minimum amount of coins he need to pay to merge all of these stones into one pile.

在这里插入图片描述

题意

这题题意比较绕,一上来还读错了。。
给你a1a_1

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值