自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 【HDU】1372 Knight Moves

Problem DescriptionA friend of you is doing research on the Traveling Knight Problem (TKP) where you are to find the shortest closed tour of knight moves that visits each square of a given set of n sq...

2018-05-20 11:14:45 216

原创 【HDU】2614 Beat(C++/C)

Problem DescriptionZty is a man that always full of enthusiasm. He wants to solve every kind of difficulty ACM problem in the world. And he has a habit that he does not like to solvea problem that is ...

2018-05-19 12:13:02 254

原创 【HDU】1226 超级密码(C++/C)

Problem DescriptionIgnatius花了一个星期的时间终于找到了传说中的宝藏,宝藏被放在一个房间里,房间的门用密码锁起来了,在门旁边的墙上有一些关于密码的提示信息:密码是一个C进制的数,并且只能由给定的M个数字构成,同时密码是一个给定十进制整数N(0<=N<=5000)的正整数倍(如果存在多个满足条件的数,那么最小的那个就是密码),如果这样的密码存在,那么当你输入它以...

2018-05-18 09:53:51 528

原创 【HDU】2209 翻纸牌游戏(C/C++)

Problem Description有一种纸牌游戏,很有意思,给你N张纸牌,一字排开,纸牌有正反两面,开始的纸牌可能是一种乱的状态(有些朝正,有些朝反),现在你需要整理这些纸牌。但是麻烦的是,每当你翻一张纸牌(由正翻到反,或者有反翻到正)时,他左右两张纸牌(最左边和最右边的纸牌,只会影响附近一张)也必须跟着翻动,现在给你一个乱的状态,问你能否把他们整理好,使得每张纸牌都正面朝上,如果可以,最少需...

2018-05-17 20:46:10 2625

原创 【HDU】2514 Another Eight Puzzle(C++/C)

Problem DescriptionFill the following 8 circles with digits 1~8,with each number exactly once . Conntcted circles cannot be filled with two consecutive numbers.There are 17 pairs of connected cicles:A...

2018-05-17 16:28:10 195

原创 【HDU】1728 逃离迷宫(C++/C)

Problem Description  给定一个m × n (m行, n列)的迷宫,迷宫中有两个位置,gloria想从迷宫的一个位置走到另外一个位置,当然迷宫中有些地方是空地,gloria可以穿越,有些地方是障碍,她必须绕行,从迷宫的一个位置,只能走到与它相邻的4个位置中,当然在行走过程中,gloria不能走到迷宫外面去。令人头痛的是,gloria是个没什么方向感的人,因此,她在行走过程中,不能...

2018-05-17 14:42:44 1586

原创 【HDU】1269 迷宫城堡(C++)

Problem Description为了训练小希的方向感,Gardon建立了一座大城堡,里面有N个房间(N<=10000)和M条通道(M<=100000),每个通道都是单向的,就是说若称某通道连通了A房间和B房间,只说明可以通过这个通道由A房间到达B房间,但并不说明通过它可以由B房间到达A房间。Gardon需要请你写个程序确认一下是否任意两个房间都是相互连通的,即:对于任意的i和j,...

2018-05-16 20:29:29 932

原创 【LeetCode】108. Convert Sorted Array to Binary Search Tree(C++)

Given an array where elements are sorted in ascending order, convert it to a height balanced BST.For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the t...

2018-05-14 22:11:06 234

原创 【LeetCode】733. Flood Fill (C++)

An image is represented by a 2-D array of integers, each integer representing the pixel value of the image (from 0 to 65535).Given a coordinate (sr, sc) representing the starting pixel (row and column...

2018-05-14 21:19:17 558

原创 【LeetCode】100. Same Tree

Given two binary trees, write a function to check if they are the same or not.Two binary trees are considered the same if they are structurally identical and the nodes have the same value.Example 1:In...

2018-05-14 20:47:43 147

原创 【LeetCode】690 Employee Importance(C++)

You are given a data structure of employee information, which includes the employee's unique id, his importance value and his directsubordinates' id.For example, employee 1 is the leader of employee 2...

2018-05-14 20:23:30 220

原创 【LeetCode】695. Max Area of Island

题目:Given a non-empty 2D array grid of 0's and 1's, an island is a group of 1's (representing land) connected 4-directionally (horizontal or vertical.) You may assume all four edges of the grid are sur...

2018-05-11 16:38:28 147

原创 【LeetCode】226. Invert Binary Tree(C++)

Invert a binary tree. 4 / \ 2 7 / \ / \1 3 6 9to 4 / \ 7 2 / \ / \9 6 3 1这道题我是用递归求解的,代码如下:代码:(递归)/** * Definition for a binary tree node. * struct TreeN...

2018-05-07 22:02:01 187

原创 【LeetCode】104. Maximum Depth of Binary Tree(C++)

Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.Note: A leaf is a node with no children.Ex...

2018-05-07 21:24:19 137

原创 【LeetCode】260. Single Number III(C++)

Given an array of numbers nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements that appear only once.For example:Given nums = [1,...

2018-05-06 11:51:17 248

原创 【LeetCode】137. Single Number II(C++)

Given a non-empty array of integers, every element appears three times except for one, which appears exactly once. Find that single one.Note:Your algorithm should have a linear runtime complexity. Cou...

2018-05-06 10:51:34 285

原创 【LeetCode】136 Single Number(C++)

Given a non-empty array of integers, every element appears twice except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it without using ...

2018-05-06 10:10:20 196

原创 【LeetCode】Merge Two Binary Trees(C++)

Given two binary trees and imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are not.You need to merge them into a new binary tree. ...

2018-05-05 22:06:51 237

原创 【LeetCode】 Hamming Distance (C++)

The Hamming distance between two integers is the number of positions at which the corresponding bits are different.Given two integers x and y, calculate the Hamming distance.Note:0 ≤ x, y < 231.Exa...

2018-05-05 21:33:10 216

原创 【LeetCode】Merge Two Sorted Lists(C++)

Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.Example:Input: 1->2->4, 1->3->4Output: 1->1...

2018-05-05 20:34:04 149

原创 【LeetCode】Valid Parentheses(C++)

Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.An input string is valid if:Open brackets must be closed by the same type of brack...

2018-05-05 17:21:44 286

原创 【LeetCode】Two Sum (C++)

最近花了点时间了解了下C++,感觉与C还是有很多不同的。接下来坚持每天用C++写五道LeetCode。fighting!题目:Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input w...

2018-05-05 16:50:00 118

空空如也

空空如也

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

TA关注的人

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