2023年2月22日
摘要: 给定一个序列 A,求有多少非空序列 B 满足 B 是 A 的子序列 并且 ∀ k ∈ [1,lenb], k∣bk∀ k ∈ [1,lenb​], k∣bk​, // f[i][j]= f[i-1][j] + (f[i-1][j-1] ,a[i]%j==0 ) 优化: 枚举 a[i] 的因数作为 j 阅读全文
posted @ 2023-02-22 18:52 towboat 阅读(16) 评论(0) 推荐(0)
摘要: 有 n个数,每一次取一个 x ,将其删除,并将所有值为x+1 与 x−1 的数都删除,ans 加上x ,求最后最大的ans 的值. (1<=a[i]<=1e5) 考虑 f[ i ] 1~i 的数字 最大ans ,f[i]=max{ f[i-1], f[i-2]+cnt[i] *i ) #includ 阅读全文
posted @ 2023-02-22 15:12 towboat 阅读(22) 评论(0) 推荐(0)
摘要: x,y= map(int,input().split()) print(x," ",y) 9TTXwpbgdWhtkB3 a=[32,43,21,431] a.append(3) a.remove(21) print(a) a.extend([98,21]) print(a) a.insert(0, 阅读全文
posted @ 2023-02-22 12:55 towboat 阅读(7) 评论(0) 推荐(0)
摘要: 大意是:给你nn个字符串,将这些字符串拼接,求一个最长的序列,使这个其中每个串的最后一个字母与第一个字母相同(最后一个串的最后一个字母与第一个串的第一个字母相同),而且后面的串只能接在前面的串的后边。 f[ch][ch] 首尾为ch , 的最大长度 对某个 串s , f[j][y]= max{ f[ 阅读全文
posted @ 2023-02-22 11:52 towboat 阅读(21) 评论(0) 推荐(0)
摘要: https://vjudge.net/problem/POJ-1149 #include <iostream> #include<queue> #include <cstring> #define IOS std::ios::sync_with_stdio(0) using namespace st 阅读全文
posted @ 2023-02-22 00:15 towboat 阅读(22) 评论(0) 推荐(0)