题目 Source http://acm.split.hdu.edu.cn/showproblem.php?pid=5863 Description cjj has k kinds of characters the number of which are infinite. He wants to build two strings with the characters. The lengths of the strings are both equal to n. cjj also def…
矩阵快速幂 #include<bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const int MOD = 1e9+7; int N,M,K; struct Matrix{ int a[25][25]; int n; Matrix(int _n=0){ memset(a,0,sizeof(a)); n = _n; } Matrix operator *(const Matrix &T) const{ Ma…
矩阵快速幂 #include<bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const int MOD = 1e9+7; int N,M,K; struct Matrix{ int a[25][25]; int n; Matrix(int _n=0){ memset(a,0,sizeof(a)); n = _n; } Matrix operator *(const Matrix &T) const{ Ma…
solved 7/11 2016 Multi-University Training Contest 10 题解链接 分类讨论 1001 Median(BH) 题意: 有长度为n排好序的序列,给两段子序列[l1,r1],[l2,r2]构成新的序列,问中间的数字. 思路: 根据不同情况分类讨论即可.时间复杂度O(1). 代码: #include <bits/stdc++.h> const int N = 1e5 + 5; int a[N]; int n, m; int l1, r1, l2, r…