当前位置:网站首页>tommy's spell
tommy's spell
2022-08-10 12:06:00 【51CTO】
题目描述
托米没有完成上一个任务,准备施展黑魔法推倒 1317
黑魔法咒语被描述为一个 长为 n 的,仅包含小写英文字母 'a'...'i' 的字符串,在托米所在的星球,魔法造成的每次有效伤害都是来自他的一个子序列,对于每一个 'a'... 'i' 的排列(共 9! 种),若作为咒语的子序列出现, 就会造成 1 的伤害
而咒语的总伤害为所有 'a'... 'i' 的排列造成的伤害值之和,托米能打出多少点的伤害,是否能击败 1317 呢?
输入描述:
一行输入一个字符串 s
输出描述:
一行输出一个数,表示伤害值
示例1
输入
aabcdefghi
输出
1
备注:
|s| ≤ 3000
This is problem solving,dp[i][j]表示第inearest to the right j 的位置.It is easy to find when looking for a full array.
代码:
边栏推荐
猜你喜欢
随机推荐
LeetCode 82. Remove Duplicate Elements in Sorted List II
Where can I view the version record of WeChat applet submission review history?
基于UiAutomator2+PageObject模式开展APP自动化测试实战
A little self-deprecating deconstruction about farmers "code"
Buckle exercise - rectangular area does not exceed the maximum value of K and (hard)
LeetCode 362. Design Hit Counter
一文读懂NFT数字藏品为何风靡全球?
Flutter气泡框实现
常量及数据类型你还记得多少?
LeetCode 138. 复制带随机指针的链表
16、Pytorch Lightning入门
Microchip launched a high-performance 77GHz millimeter-wave radar chip, and has received tens of thousands of orders before mass production
Analysis of the name matching process between the LCD driver and the device (Tiny4412)
LeetCode 19. 删除链表的倒数第 N 个结点
力扣练习——60 二叉搜索子树的最大键值和
codevs 2370 小机房的树 (LCA)
怎么加入自媒体,了解这5种变现模式,让账号快速变现
LeetCode 146. LRU 缓存
search--09
托米的咒语









