题目描述 Farmer John's NNN cows are standing in a row, as they have a tendency to do from time to time. Each cow is labeled with a distinct integer ID num ...
分类:
其他好文 时间:
2018-02-14 15:36:03
阅读次数:
173
[抄题]: 给出字符串S和字符串T,计算S的不同的子序列中T出现的个数。 子序列字符串是原始字符串通过删除一些(或零个)产生的一个新的字符串,并且对剩下的字符的相对位置没有影响。(比如,“ACE”是“ABCDE”的子序列字符串,而“AEC”不是)。 Here is an example:S = "r ...
分类:
其他好文 时间:
2018-02-11 19:58:24
阅读次数:
121
题意 给定$n$个数,求最长上升子序列的方案数 根据数据范围要求是$O(n\log n)$ 朴素的dp方程式$f_i=max(f_j+1),a_i a_j$,所以记方案数为$v_i$,则$v_i=v_i+v_j,(f_i=f_j+1)$,利用lis的$O(n\log n)$树状数组做法同时维护长度和 ...
分类:
编程语言 时间:
2018-01-25 00:12:05
阅读次数:
163
lc 730 Count Different Palindromic Subsequences [730 Count Different Palindromic Subsequences][1] Given a string S, find the number of different non e ...
分类:
其他好文 时间:
2018-01-09 23:19:52
阅读次数:
753
"欢迎fork and star:Nowcoder Repository github" 115. Distinct Subsequences 题目 解析 此题花费很多时间,对递推公式理解不清楚,用一维表示减少空间 对比最大公共子序列和子串 题目来源 "115. Distinct Subsequen ...
分类:
其他好文 时间:
2018-01-07 17:30:21
阅读次数:
232
Given a string S, find the number of different non-empty palindromic subsequences in S, and return that number modulo 10^9 + 7. A subsequence of a str ...
分类:
其他好文 时间:
2017-12-01 15:13:58
阅读次数:
766
题目: Given a string S and a string T, count the number of distinct subsequences of S which equals T. A subsequence of a string is a new string which is ...
分类:
编程语言 时间:
2017-11-21 14:45:14
阅读次数:
208
1、原题链接 Given a string S and a string T, count the number of distinct subsequences of S which equals T. A subsequence of a string is a new string which ...
分类:
其他好文 时间:
2017-11-21 01:10:08
阅读次数:
143
原题链接在这里:https://leetcode.com/problems/split-array-into-consecutive-subsequences/description/ 题目: You are given an integer array sorted in ascending or ...
分类:
其他好文 时间:
2017-10-26 10:24:12
阅读次数:
274
CodeForces 803F 题意:给出一个序列,问有多少个 gcd 为 1 的子序列。 tags:考虑求出 gcd > 1 的子序列个数,再用 (2^n)-1 减去它即是答案。 枚举 gcd为 g,预处理出 a[] 的因子,然后看有多少个 a[] 是 g 的倍数,假设有 cnt 个,那就有 (2 ...
分类:
其他好文 时间:
2017-10-09 20:58:45
阅读次数:
109