
中兴算法挑战赛-比特派
圆滚滚的柴柴
这个作者很懒,什么都没留下…
展开
-
中兴算法挑战赛-比特派:换队伍
题目贴在最后。 思路: 并不难,但是,ArrayList 和 LinkedList 删除效率很低,所以要用 LinkedHashSet。 需要 删除效率高的有序 数据结构,双向链表 + 哈希。 代码: // 本题为考试多行输入输出规范示例,无需提交,不计分。 import java.util.*; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(S原创 2021-04-25 20:15:44 · 206 阅读 · 0 评论 -
中兴算法挑战赛-比特派:做任务
题目贴在最后。 思路: 借助栈。建5个栈,分别保存1~5的任务序号,由于每次取编号最大的,所以只需弹出栈顶元素即可。 代码: // 本题为考试多行输入输出规范示例,无需提交,不计分。 import java.util.*; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.next原创 2021-04-25 19:16:49 · 187 阅读 · 0 评论 -
中兴算法挑战赛-比特派:切绳子
题目贴在最后。 思路: 这个题也很简单,比赛的时候我一直过不了。。。。。后来才发现绳子的长度比较大,要用long型才可以AC。积累经验,加油加油。 代码: // 本题为考试多行输入输出规范示例,无需提交,不计分。 import java.util.*; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n原创 2021-04-25 16:49:14 · 145 阅读 · 0 评论 -
中兴算法挑战赛-比特派:跳高
题目贴在后面。 思路: 这个题比较简单,数组排序找最大的即可。 代码: // 本题为考试多行输入输出规范示例,无需提交,不计分。 import java.util.*; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); int h = scan原创 2021-04-25 16:28:34 · 170 阅读 · 0 评论