摘要: 引入 P2842 纸币问题 1 题目描述某国有 \(n\) 种纸币,每种纸币面额为 \(a_i\) 并且有无限张,现在要凑出 \(w\) 的金额,试问最少用多少张纸币可以凑出来?(保证可以凑出对应金额) 第一行两个整数 \(n,w\),分别表示纸币的种数和要凑出的金额。 第二行一行 \(n\) 个以 阅读全文
posted @ 2025-09-16 17:33 R-99Player 阅读(27) 评论(0) 推荐(0)
摘要: 1.广度优先遍历 2.深度优先遍历 1.前序遍历 根结点--左子树--右子树 void pre(int p){ printf("%d\n",p); if(tree[p].l)pre(tree[p].l); if(tree[p].r)pre(tree[p].r); } 2.中序遍历 左子树--根结点- 阅读全文
posted @ 2025-09-16 12:35 R-99Player 阅读(7) 评论(0) 推荐(0)