上一页 1 ··· 27 28 29 30 31 32 33 34 35 ··· 54 下一页
  2023年2月26日
摘要: 给一些字符串,问以某个串为前缀的串有几个 #include<iostream> #include <algorithm> #include <cstring> using namespace std; const int N=5e5+4; char num[80]; int len,sum[N]; 阅读全文
posted @ 2023-02-26 17:02 towboat 阅读(18) 评论(0) 推荐(0)
摘要: 其中 f(1)=x0,f(2)=y0, f( i )=f( i-1 )+f( i+1 ),求 f(n) #include <iostream> #include <cmath> #include <algorithm> using namespace std; #define N 2 int mod 阅读全文
posted @ 2023-02-26 15:34 towboat 阅读(14) 评论(0) 推荐(0)
摘要: ans=0; for(i=1;i<=n;i++) { if(i&1)ans=(ans*2+1)%m; else ans=ans*2%m; } 使用矩阵快速幂计算 f[n ] f[n] = f[n-1]+f[n-2]*2 +1 { f[n] ,f[n-1] ,1 } = { f[n-1] ,f[ n- 阅读全文
posted @ 2023-02-26 14:35 towboat 阅读(21) 评论(0) 推荐(0)
摘要: #include <iostream> #include <cmath> #include <algorithm> using namespace std; #define N 2 int mod; #define int long long struct matrix { int a[N+2][N 阅读全文
posted @ 2023-02-26 12:32 towboat 阅读(6) 评论(0) 推荐(0)
摘要: 求矩阵的 k 次幂 #define int long long #define N 3 int mod =1e9+7; struct matrix { int a[N+2][N+2]; }; int n; void init_(matrix &x){ memset(x.a,0,sizeof x.a) 阅读全文
posted @ 2023-02-26 12:07 towboat 阅读(13) 评论(0) 推荐(0)
摘要: 定义某数组 xx 的权值为 sum{ sum{ a[i]+b[i] } } i<j<n 现在,给定两个长度为 nn 的数组 a,ba,b。你可以执行若干次操作,每次操作选择一个下标 ii,并交换 ai,bi 。 求在进行操作之后两个数组的权值之和最小能够达到多少。 = (a1+....an )^2 阅读全文
posted @ 2023-02-26 10:25 towboat 阅读(31) 评论(0) 推荐(0)
  2023年2月25日
摘要: 有n个菜(0<n<=18)第i个菜的满意度为a[i ](0<=ai<=10^9),有k个规则,如果在吃完第xi个菜之后吃了第yi个菜, 会额外获得ci的满意度。kefa要吃m道任意的菜(0<m<=n),但是他希望自己吃菜的顺序得到的满意度最大 f[j][i] = f[j^(1<<i) ] [k ]+ 阅读全文
posted @ 2023-02-25 19:03 towboat 阅读(12) 评论(0) 推荐(0)
  2023年2月24日
摘要: 从序列中每次消去回文串,问最少几次消除完 #include <iostream> #include <cstring> using namespace std ; const int N=503,inf=0x3f3f3f3f; int f[N][N],a[N],n; signed main(){ i 阅读全文
posted @ 2023-02-24 21:39 towboat 阅读(13) 评论(0) 推荐(0)
摘要: 从序列中找一些数,使平均数>=m,问最少取几个数》 #include <iostream> #include<algorithm> #include <cstring> #define IOS std::ios::sync_with_stdio(0) using namespace std; con 阅读全文
posted @ 2023-02-24 14:47 towboat 阅读(14) 评论(0) 推荐(0)
摘要: 给3个数字, 求组成n 的方案中 数字个数最多的 ? #include <iostream> #include<queue> #include <cstring> #define IOS std::ios::sync_with_stdio(0) using namespace std; const 阅读全文
posted @ 2023-02-24 12:30 towboat 阅读(9) 评论(0) 推荐(0)
上一页 1 ··· 27 28 29 30 31 32 33 34 35 ··· 54 下一页