随笔分类 - 算法题
记录我完成的算法题目
发表于 2019-12-26 18:24阅读次数:2992评论次数:1
摘要:title: 高效算法求解数独 date: 2019 12 26 17:55:16 tags: 数据结构与算法 categories: 数据结构与算法 背景 之前上python课的时候,有一次实验是求解数独,要求时间复杂度要低;为此老师讲解了一个高效的数独算法,我觉得算法挺有意思的,写篇博客记录一下
阅读全文 »
发表于 2018-11-23 21:22阅读次数:251评论次数:0
摘要:Super Mario Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 9714 Accepted Submission(s): 4113 Pro
阅读全文 »
发表于 2018-10-31 21:34阅读次数:236评论次数:0
摘要:Flowers Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 3687 Accepted Submission(s): 1821 Problem
阅读全文 »
发表于 2018-10-27 17:40阅读次数:370评论次数:0
摘要:Apple Tree Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 36442 Accepted: 10894 Description There is an apple tree outside of kaka's house
阅读全文 »
发表于 2018-09-29 18:53阅读次数:374评论次数:0
摘要:在平常的题目当中,我们偶尔会遇上这种情况:给出了50000个数,数的范围是0-999999999;我们在题目中需要以数的大小为下标进行操作,但是数据太大,无法开这么大的数组,怎么办。若在题目当中,我们只需要用到数与数之间的相对大小关系,而不需要数的具体数值,则可以使用离散化。(例如:求逆序数的对数)
阅读全文 »
发表于 2018-09-09 17:00阅读次数:261评论次数:0
摘要:Sudoku Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 24081 Accepted: 11242 Special Judge Description Sudoku is a very simple task. A squa
阅读全文 »
发表于 2018-08-03 11:02阅读次数:178评论次数:0
摘要:Masha has recently bought a cleaner robot, it can clean a floor without anybody's assistance. Schematically Masha's room is a rectangle, consisting of
阅读全文 »
发表于 2018-08-03 10:29阅读次数:183评论次数:0
摘要:A gourmet came into the banquet hall, where the cooks suggested n dishes for guests. The gourmet knows the schedule: when each of the dishes will be s
阅读全文 »
发表于 2018-08-03 09:59阅读次数:256评论次数:0
摘要:Welcoming autumn evening is the best for walking along the boulevard and npeople decided to do so. The boulevard can be represented as the axis Ox. Fo
阅读全文 »
发表于 2018-07-29 10:54阅读次数:247评论次数:0
摘要:题意:n个点连成的生成树(n个点,n-1条边,点与点之间都连通),如果某个点在两点之间的路径上,那这个点的繁荣度就+1,问你在所有点中,最大繁荣度是多少?就比如上面的图中的C点,在A-B,A-D,A-E,A-F,B-D,B-E,B-F的路径上,所以繁荣度为7。 思路:我们可以想一下,繁荣度是怎么来的
阅读全文 »
发表于 2018-07-27 16:41阅读次数:234评论次数:0
摘要:题意:给出了你由n个数组成的序列,让你将这个序列分为成m个集合,使得每一个集合的最大值减最小值的差相加最小。(如果某集合只有一个数字,则最大值减最小值为0) 。 思路:首先我们不难想到,最优的分配方法一定是先给这n个数排序,然后将排序好的数分成m段。因为和一个数相差最小的数,就是在有序序列中与它相邻
阅读全文 »
发表于 2018-07-25 17:03阅读次数:313评论次数:0
摘要:1459 迷宫游戏 基准时间限制:1 秒 空间限制:131072 KB 分值: 0 难度:基础题 收藏 关注 你来到一个迷宫前。该迷宫由若干个房间组成,每个房间都有一个得分,第一次进入这个房间,你就可以得到这个分数。还有若干双向道路连结这些房间,你沿着这些道路从一个房间走到另外一个房间需要一些时间。
阅读全文 »
发表于 2018-07-25 13:18阅读次数:248评论次数:0
摘要:Three Palindromes Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1948 Accepted Submission(s): 68
阅读全文 »
发表于 2018-07-24 10:41阅读次数:347评论次数:0
摘要:Little X used to play a card game called "24 Game", but recently he has found it too easy. So he invented a new game. Initially you have a sequence of
阅读全文 »
发表于 2018-07-24 10:24阅读次数:157评论次数:0
摘要:Little Artem is fond of dancing. Most of all dances Artem likes rueda — Cuban dance that is danced by pairs of boys and girls forming a circle and dan
阅读全文 »
发表于 2018-07-20 13:48阅读次数:545评论次数:0
摘要:1057 N的阶乘 基准时间限制:1 秒 空间限制:131072 KB 分值: 0 难度:基础题 收藏 关注 输入N求N的阶乘的准确值。 Input 输入N(1 <= N <= 10000) Output 输出N的阶乘 Input示例 5 Output示例 120思路:按照乘法运算的规则进行模拟,声
阅读全文 »
发表于 2018-07-19 12:19阅读次数:407评论次数:0
摘要:Each month Blake gets the report containing main economic indicators of the company "Blake Technologies". There are n commodities produced by the comp
阅读全文 »
发表于 2018-07-18 14:27阅读次数:168评论次数:0
摘要:Statements Vitaly works at the warehouse. The warehouse can be represented as a grid of n × mcells, each of which either is free or is occupied by a c
阅读全文 »
发表于 2018-07-17 11:17阅读次数:347评论次数:0
摘要:Farey Sequence Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 18507 Accepted: 7429 Description The Farey Sequence Fn for any integer n wit
阅读全文 »
发表于 2018-07-17 11:01阅读次数:201评论次数:0
摘要:Longge's problem Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 9190 Accepted: 3073 Description Longge is good at mathematics and he likes
阅读全文 »