上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 26 下一页
摘要: 不使用 vector 的写法 点击查看代码 #include<iostream> #include<cmath> using namespace std; // 计算 n 有多少位 int dgt(int n) { int res = 0; while (n) { res ++; n /= 10; 阅读全文
posted @ 2022-05-25 09:40 wKingYu 阅读(34) 评论(0) 推荐(0)
摘要: 类比完全背包 复杂度 \(O(n^{2})\) 总体复杂度 \(1000^{2} = 1 \times 10^{6}\) 点击查看代码 #include<iostream> using namespace std; const int N = 1010, mod = 1e9 + 7; int n; 阅读全文
posted @ 2022-05-24 20:44 wKingYu 阅读(42) 评论(0) 推荐(0)
摘要: 复杂度 \(O(n^{3})\) 总体复杂度 \(300^{3} = 2.7 \times 10^{7}\) 点击查看代码 #include<iostream> using namespace std; const int N = 300 + 10; int n; int s[N]; int f[N 阅读全文
posted @ 2022-05-24 20:10 wKingYu 阅读(69) 评论(0) 推荐(0)
摘要: 复杂度 \(O(n \cdot m \cdot l^{2})\) 总体复杂度 \(1000 \times 1000 \times 10^{2} = 1 \times 10^{8}\) 点击查看代码 #include<iostream> #include<cstring> using namespac 阅读全文
posted @ 2022-05-24 17:48 wKingYu 阅读(39) 评论(0) 推荐(0)
摘要: 复杂度 \(O(n^{2})\) 总体复杂度 \(1000^{2} = 1 \times 10^{6}\) 点击查看代码 #include<iostream> using namespace std; const int N = 1010; int n, m; char a[N], b[N]; in 阅读全文
posted @ 2022-05-24 17:07 wKingYu 阅读(36) 评论(0) 推荐(0)
摘要: 复杂度 $O(n \cdot m)$ 总体复杂度 $ 1000 \times 1000 = 1 \times 10^{6} $ 点击查看代码 #include<iostream> using namespace std; const int N = 1010; int n, m; char a[N] 阅读全文
posted @ 2022-05-23 21:07 wKingYu 阅读(67) 评论(0) 推荐(0)
摘要: 贪心 + 二分 复杂度 \(O(n \cdot log(n))\) 总体复杂度 \(1 \times 10^{5} \times log(1 \times 10^{5} ) \approx 1.66 \times 10^{6}\) 点击查看代码 #include<iostream> using na 阅读全文
posted @ 2022-05-23 19:58 wKingYu 阅读(42) 评论(0) 推荐(0)
摘要: 线性 dp 复杂度 $ O(n^{2}) $ 点击查看代码 #include<iostream> using namespace std; const int N = 1010; int n; int a[N], f[N]; int main() { cin >> n; for (int i = 0 阅读全文
posted @ 2022-05-23 18:01 wKingYu 阅读(37) 评论(0) 推荐(0)
摘要: 使用一维数组优化 复杂度 \(n^{2}\) 总体复杂度 \(500^{2} = 2.5 \times 10^{5}\) 点击查看代码 #include<iostream> using namespace std; const int N = 510, INF = 1e9; int n; int a 阅读全文
posted @ 2022-05-20 18:28 wKingYu 阅读(22) 评论(0) 推荐(0)
摘要: 点击查看代码 #include<iostream> using namespace std; const int N = 110; int n, m; int v[N][N], w[N][N], s[N]; int f[N]; int main() { cin >> n >> m; for (int 阅读全文
posted @ 2022-05-20 17:28 wKingYu 阅读(24) 评论(0) 推荐(0)
上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 26 下一页