随笔分类 - 刷题(数据结构和算法)
摘要:LeetCode781. 森林中的兔子 示例:输入: answers = [1, 1, 2]输出: 5解释:两只回答了 "1" 的兔子可能有相同的颜色,设为红色。之后回答了 "2" 的兔子不会是红色,否则他们的回答会相互矛盾。设回答了 "2" 的兔子为蓝色。此外,森林中还应有另外 2 只蓝色兔子的回
阅读全文
摘要:本题预计涉及:dfs搜索,康托展开(为了寻找映射来判重),曼哈顿距离 Eight II Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 130000/65536 K (Java/Others)Total Submission(s): 8374
阅读全文
摘要:Today is Ignatius' birthday. He invites a lot of friends. Now it's dinner time. Ignatius wants to know how many tables he needs at least. You have to
阅读全文
摘要:ACboy was kidnapped!! he miss his mother very much and is very scare now.You can't image how dark the room he was put into is, so poor :(. As a smart
阅读全文
摘要:1 #include<stdio.h> 2 #include<string.h> 3 #include<stdlib.h> 4 typedef struct person{ 5 int num; 6 struct person* next; 7 }P; 8 int main() 9 { 10 int
阅读全文
摘要:Description 憨憨吃素是憨憨吃透了素数的缩写,某一天他在看到了这样的一张图: 该图向憨憨展示了一个非常酷的“全素日”:20192019年55月2323日。即不仅2019052320190523本身是个素数,它的任何以末尾数字33结尾的子串都是素数。这是憨憨吃素后迎接的第一个挑战,请问给你一
阅读全文