自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(17)
  • 收藏
  • 关注

原创 HDU 1072 Nightmare

题目hduoj1072NightmareProblem DescriptionIgnatius had a nightmare last night. He found himself in a labyrinth with a time bomb on him. The labyrinth has an exit, Ignatius should get out of the labyrinth before the bomb explodes. The initial exploding tim

2021-02-26 21:52:22 177

原创 HDU 1026 Ignatius and the Princess I

题目hduoj1026Problem DescriptionThe Princess has been abducted by the BEelzebub feng5166, our hero Ignatius has to rescue our pretty Princess. Now he gets into feng5166’s castle. The castle is a large labyrinth. To make the problem simply, we assume the l

2021-02-26 12:25:28 239

转载 【转载】c++常用排序规则,以及优先队列记录

#include<algorithm>#include<iostream>#include<vector>#include<queue>using namespace std;bool cmp1(int a,int b){ return a > b;}struct number1{ int a; number1(){} number1(int a):a(a){} bool operator

2021-02-25 17:02:19 152

原创 HDU 1016 Prime Ring Problem

题目Prime Ring Problemhduoj1016Problem DescriptionA ring is compose of n circles as shown in diagram. Put natural number 1, 2, …, n into each circle separately, and the sum of numbers in two adjacent circles should be a prime.Note: the number of first c

2021-02-25 12:29:49 94

原创 HDU 1015 Safecracker

题目hduoj1015SafecrackerProblem Description=== Op tech briefing, 2002/11/02 06:42 CST ===“The item is locked in a Klein safe behind a painting in the second-floor library. Klein safes are extremely rare; most of them, along with Klein and his factory, w

2021-02-24 22:38:14 208

原创 HDU 1010

题目:Tempter of the BoneProblem DescriptionThe doggie found a bone in an ancient maze, which fascinated him a lot. However, when he picked it up, the maze began to shake, and the doggie could feel the ground sinking. He realized that the bone was a trap,

2021-02-23 22:19:26 108 1

原创 关于Java中TreeSet的元素有序

一、Comparable的使用(重写CompareTo(To)方法)Student类package Collection.Set;import java.util.Objects;public class Student implements Comparable<Student>{ private int age; private String name; public Student() { } public Student(int

2021-02-22 19:02:21 263 2

原创 leetcode--167. 两数之和 II - 输入有序数组

题目链接https://leetcode-cn.com/problems/two-sum-ii-input-array-is-sorted/一、题目给定一个已按照 升序排列 的整数数组 numbers ,请你从数组中找出两个数满足相加之和等于目标数 target 。函数应该以长度为 2 的整数数组的形式返回这两个数的下标值。numbers 的下标 从 1 开始计数 ,所以答案数组应当满足 1 <= answer[0] < answer[1] <= numbers.length 。

2021-02-17 21:25:54 94

原创 leetcode--160. 相交链表

题目链接https://leetcode-cn.com/problems/intersection-of-two-linked-lists/一、题目编写一个程序,找到两个单链表相交的起始节点。如下面的两个链表:示例 1:输入:intersectVal = 8, listA = [4,1,8,4,5], listB = [5,0,1,8,4,5], skipA = 2, skipB = 3输出:Reference of the node with value = 8输入解释:相交节点的值为

2021-02-10 15:32:14 116

原创 leetcode--141. 环形链表

题目链接https://leetcode-cn.com/problems/linked-list-cycle/submissions/一、题目给定一个链表,判断链表中是否有环。如果链表中有某个节点,可以通过连续跟踪 next 指针再次到达,则链表中存在环。 为了表示给定链表中的环,我们使用整数 pos 来表示链表尾连接到链表中的位置(索引从 0 开始)。 如果 pos 是 -1,则在该链表中没有环。注意:pos 不作为参数进行传递,仅仅是为了标识链表的实际情况。如果链表中存在环,则返回 true

2021-02-06 18:45:46 150

原创 leetcode--136. 只出现一次的数字

题目链接https://leetcode-cn.com/problems/single-number/一、题目给定一个非空整数数组,除了某个元素只出现一次以外,其余每个元素均出现两次。找出那个只出现了一次的元素。说明:你的算法应该具有线性时间复杂度。 你可以不使用额外空间来实现吗?示例 1:输入: [2,2,1]输出: 1示例 2:输入: [4,1,2,1,2]输出: 4二、分析与代码这个题如果再开一个数组来做是很快的,但题目要求不使用多余的空间1.暴力(耗时过长)一路写下来的

2021-02-06 16:30:01 76

原创 leetcode--122. 买卖股票的最佳时机 II

题目链接https://leetcode-cn.com/problems/best-time-to-buy-and-sell-stock-ii/一、题目给定一个数组,它的第 i 个元素是一支给定股票第 i 天的价格。设计一个算法来计算你所能获取的最大利润。你可以尽可能地完成更多的交易(多次买卖一支股票)。注意:你不能同时参与多笔交易(你必须在再次购买前出售掉之前的股票)。示例 1:输入: [7,1,5,3,6,4]输出: 7解释: 在第 2 天(股票价格 = 1)的时候买入,在第 3 天(

2021-02-06 15:59:16 133

原创 leetcode--119. 杨辉三角 II

题目链接https://leetcode-cn.com/problems/pascals-triangle-ii/一、题目给定一个非负索引 k,其中 k ≤ 33,返回杨辉三角的第 k 行。在杨辉三角中,每个数是它左上方和右上方的数的和。示例:输入: 3输出: [1,3,3,1]二、分析与代码1.代码如下(示例):/** * Note: The returned array must be malloced, assume caller calls free(). */int*

2021-02-06 15:01:30 136

原创 leetcode--112. 路径总和

题目链接https://leetcode-cn.com/problems/path-sum/一、题目给你二叉树的根节点 root 和一个表示目标和的整数 targetSum ,判断该树中是否存在 根节点到叶子节点 的路径,这条路径上所有节点值相加等于目标和 targetSum 。叶子节点 是指没有子节点的节点。示例 3:输入:root = [1,2], targetSum = 0输出:false二、代码代码如下(示例):/** * Definition for a binary t

2021-02-05 16:48:48 69

原创 HDU 2612

题目DescriptionPass a year learning in Hangzhou, yifenfei arrival hometown Ningbo at finally. Leave Ningbo one year, yifenfei have many people to meet. Especially a good friend Merceki.Yifenfei’s home is at the countryside, but Merceki’s home is in the ce

2021-02-04 22:57:00 79

原创 关于广搜(BFS)

1、步骤顺序:A先入队列,找到B和C,之后B、C入队列,A出队列;B找到D和E,之后B出队列,C找到F和G,之后C出队列;…以此类推<-- [A]<-- [B] [C]<-- [C] [D] [E]<-- [D] [E] [F] [G]<-- [E] [F] [G]<-- [F] [G]<-- [G]2、3、关于c++中的队列BFS一般需要用到队列,所以我们必须牢记队列中的一些常用函数#include<cstdio&gt

2021-02-03 22:29:05 171 3

原创 leetcode--111. 二叉树的最小深度

此题和二叉树最大深度差不多题目链接https://leetcode-cn.com/problems/minimum-depth-of-binary-tree/一、题目给定一个二叉树,找出其最小深度。最小深度是从根节点到最近叶子节点的最短路径上的节点数量。说明:叶子节点是指没有子节点的节点。输入:root = [3,9,20,null,null,15,7]输出:2示例 2:输入:root = [2,null,3,null,4,null,5,null,6]输出:5提示:树中节点数的范

2021-02-02 21:18:30 134 1

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除