自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 HDU-3038 How Many Answers Are Wrong

Problem DescriptionTT and FF are ... friends. Uh... very very good friends -________-bFF is a bad boy, he is always wooing TT to play the following game with him. This is a very humdrum game.

2017-04-07 09:58:00 290

原创 HDU-1213 How Many Tables

Problem DescriptionToday 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 notice that not all the fri

2017-04-07 09:37:54 200

原创 POJ-1611 The Suspects

Severe acute respiratory syndrome (SARS), an atypical pneumonia of unknown aetiology, was recognized as a global threat in mid-March 2003. To minimize transmission to others, the best strategy is to s

2017-04-07 09:34:02 186

原创 POJ-2236 Wireless Network

DescriptionAn earthquake takes place in Southeast Asia. The ACM (Asia Cooperated Medical team) have set up a wireless network with the lap computers, but an unexpected aftershock attacked, all com

2017-03-31 15:02:33 481

原创 777E Hanoi Factory

Of course you have heard the famous task about Hanoi Towers, but did you know that there is a special factory producing the rings for this wonderful game? Once upon a time, the ruler of the ancient Eg

2017-02-28 14:55:32 523

原创 777C Alyona and Spreadsheet

During the lesson small girl Alyona works with one famous spreadsheet computer program and learns how to edit tables.Now she has a table filled with integers. The table consists of n rows and m co

2017-02-28 14:32:38 290

原创 算法概论8.14

8.14. 证明如下问题是NP完全的:给定一个无向图G = (V, E)和整数k,求G中一个规模为k的团以及一个规模为k的独立集【证明】(算法导论34.5.1)(1)团:顶点子集V'⊆V,其中每一对定点之间都由E中的一条边来连接,即团是G的完全子图。对于一个给定的图G = (V, E),团中顶点集V',对于任意一对顶点u, v∈V',检查边(u, v)是否属于E,就可以在多项式时间

2017-01-15 14:14:33 392

原创 【LeetCode】134. Gas Station (Medium)

贪心

2016-11-14 23:20:11 171

原创 【LeetCode】152. Maximum Product Subarray (Medium)

动态规划

2016-11-14 23:08:17 176

原创 【LeetCode】329. Longest Increasing Path in a Matrix (Hard)

拓扑排序,动态规划

2016-11-10 01:54:52 248

原创 【LeetCode】45. Jump Game II (Hard)

贪心

2016-11-10 01:38:37 358

原创 【LeetCode】55. Jump Game (Medium)

贪心

2016-11-06 20:42:34 309

原创 【LeetCode】413. Arithmetic Slices(Medium)

动态规划。。。可能有bug。。。

2016-10-17 05:24:11 213

原创 【LeetCode】210. Course Schedule II (Medium)

拓扑排序

2016-09-22 22:48:52 190

原创 【LeetCode】207. Course Schedule (Medium)

【题意】给出一个有向图的边集,判断这个图是不是DAG【解】用DFS,记录每个节点u的发现时间 u.d 和完成时间 u.f,一个有向图是DAG当且仅当DFS不产生后向边。如果u.d v.f 说明有一条v -> u的后向边。#include#includeusing namespace std;class Solution {public: bool canFinish(int

2016-09-22 22:02:48 218

原创 【LeetCode】215. Kth Largest Element in an Array (Medium)

【题意】找出第k大的元素【解】类似快排class Solution {public: int findKthLargest(vector& nums, int k) { return f(nums, 0, nums.size(), k); }private: int f(vector& nums, int l, int r, int k) {

2016-09-14 14:18:49 188

原创 【LeetCode】53. Maximum Subarray (Medium)

分治 数组 动态规划

2016-09-14 00:31:35 207

原创 【LeetCode】240. Search a 2D Matrix II (Medium)

【题意】给一个m*n的矩阵,矩阵的每一行从左到右,从小到大排列,每一列从上到下,从小到大排列。给定一个元素,返回是不是在矩阵中。【解】把矩阵分成四个部分      1      2      3      4每个部分的最小元素在左上角,最大元素在右下角,如果要找的元素在最大和最小之间,接着分。有限步后一定会终止,不可能有元素可能既出现在1

2016-09-14 00:22:52 214

原创 【LeetCode】136.Single Number (Easy)

题意:给定一个数组,里面有一个元素只出现一次,其他都出现两次,要求O(n)时间复杂度,O(1)空间复杂度用异或 a^a = 0,所有元素异或得到的结果就是只出现一次的。int singleNumber(vector& nums) { int s = 0; for (size_t i = 0; i < nums.size(); i++)

2016-09-06 14:01:31 219

原创 【LeetCode】169.Majority Element (Easy)

题目要求:n个元素的数组,找出现次数大于[n/2]的数(保证存在)用map可以过: int majorityElement(vector& nums) { map m; for (int i = 0; i != nums.size(); i++) m[nums[i]]++; for (map::iterat

2016-09-06 01:19:57 215

空空如也

空空如也

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

TA关注的人

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