
天梯赛训练
Rain Sure
北航 计算机学院 研一
展开
-
L3-010 是否完全二叉搜索树 (30 分) (建树后 bfs的时候判断是否是完全二叉树)
#include<iostream> #include<cstring> #include<algorithm> #include<vector> #include<queue> using namespace std; const int maxn = 510; int w[maxn]; int l[maxn], r[maxn], v[maxn], idx; int tr[maxn]; int n; bool flag = true; boo..原创 2022-04-22 20:55:08 · 348 阅读 · 0 评论 -
L3-001 凑零钱 (30 分)(背包问题求具体方案)
天梯赛L3题目原创 2022-04-21 14:34:00 · 1121 阅读 · 0 评论 -
1051 Pop Sequence (25 分)(模拟堆栈)
Given a stack which can keepMnumbers at most. PushNnumbers in the order of 1, 2, 3, ...,Nand pop randomly. You are supposed to tell if a given sequence of numbers is a possible pop sequence of the stack. For example, ifMis 5 andNis 7, we can obta...原创 2021-04-21 16:46:38 · 128 阅读 · 0 评论 -
1069 微博转发抽奖 (20 分)
小明 PAT 考了满分,高兴之余决定发起微博转发抽奖活动,从转发的网友中按顺序每隔 N 个人就发出一个红包。请你编写程序帮助他确定中奖名单。 输入格式: 输入第一行给出三个正整数 M(≤1000)、N 和 S,分别是转发的总量、小明决定的中奖间隔、以及第一位中奖者的序号(编号从 1 开始)。随后 M 行,顺序给出转发微博的网友的昵称(不超过 20 个字符、不包含空格回车的非空字符串)。 注意:可能有人转发多次,但不能中奖多次。所以如果处于当前中奖位置的网友已经中过奖,则跳过他顺次取下一位。 输出格.原创 2021-04-19 19:16:21 · 100 阅读 · 0 评论