摘要: A 时间复杂度: O(n) AC代码: #include <iostream> using namespace std; int n,cnt; int a[110]; bool is_isprime(int x) { if(x<2) return false; for(int i=2;i<=x/i; 阅读全文
posted @ 2024-02-25 16:46 Eric` 阅读(5) 评论(0) 推荐(0) 编辑
摘要: A 思路: 分解质因数当指数为1并且cnt==3时满足条件 时间复杂度: o(n) AC代码: #include <iostream> using namespace std; int l,r,cnt; bool k; int c[100]; void divide(int n) { int t=n 阅读全文
posted @ 2024-02-25 16:46 Eric` 阅读(4) 评论(0) 推荐(0) 编辑
摘要: A 思路: 签到题 AC代码: #include <bits/stdc++.h> using namespace std; int a,b,k; int main() { cin>>a>>b>>k; if(a>=k*b) cout<<"good"<<endl; else cout<<"bad"<<e 阅读全文
posted @ 2024-02-25 16:45 Eric` 阅读(7) 评论(0) 推荐(0) 编辑
摘要: 一.存储 树是特殊的图 无向图是特殊的有向图 所以只需考虑有向图如何存储即可 1.邻接矩阵 空间复杂度o(n^2)-用的不多 2.邻接表(每一个节点都开一个单链表-存这个点可以走到哪个点) 注:内部点顺序无关紧要 二.遍历 (1)深度优先遍历DFS AcWing-846 #include <iost 阅读全文
posted @ 2024-02-25 00:05 Eric` 阅读(7) 评论(0) 推荐(0) 编辑
点击右上角即可分享
微信分享提示