摘要:
不同的子序列 给你两个字符串 s 和 t ,统计并返回在 s 的 子序列 中 t 出现的个数,结果需要对 109 + 7 取模。 class Solution { public: int numDistinct(string s, string t) { int dp[1100][1100];//d 阅读全文 »
摘要:
蜗牛 在每个点有两个状态,一个是在y=0处,一个是在上一个杆传过来的传送门处 注意最后到达的点一定是在y=0处 #include<bits/stdc++.h> using namespace std; #define int long long #define endl "\n" #define i 阅读全文 »
摘要:
结果为真的序列I 当前位置填的False或者true和当前结果1或者0两两组合一共四个状态,也可以可以写成一维的 #include<bits/stdc++.h> using namespace std; #define int long long #define endl "\n" #define 阅读全文 »
摘要:
背包与魔法 01背包的变形 因为只能用一次魔法就多加一维1表示用了魔法 0表示没用魔法 #include<bits/stdc++.h> using namespace std; #define int long long #define endl "\n" #define inf 1e18 cons 阅读全文 »
摘要:
翻转后1的数量 最重要的还是状态的设置,多积累吧 #include<bits/stdc++.h> using namespace std; #define int long long #define endl "\n" #define inf 1e18 const int N = 1e5 + 10; 阅读全文 »