摘要:
求LCS及输出一种具体的LCS序列。 #include <bits/stdc++.h>using namespace std;const int N = 1e3 + 10;int n, m, a[N], b[N], f[N][N];int main() { cin >> n >> m; for (i 阅读全文
摘要:
质数的判定 试除法:判定n是否为质数,扫描2~sqrt(n)即可,特判0和1这两个数,它们既不是质数,也不是合数。 bool is_prime(int n) { if (n < 2) return 0; for (int i = 2; i <= sqrt(n); i ++) if (n % i == 阅读全文
摘要:
将n!分解质因数。 先筛选出[1,n]中的质数pi,再统计ci。 #include <bits/stdc++.h> #define int long long using namespace std; const int N = 1e6 + 10; int n, p[N], c[N], tot; b 阅读全文