- 博客(45)
- 收藏
- 关注
转载 (转) 一位ACMer过来人的心得
转载地址:http://blog.csdn.net/lyy289065406/article/details/6642572刻苦的训练我打算最后稍微提一下。主要说后者:什么是有效地训练? 我想说下我的理解。 很多ACMer入门的时候,都被告知:要多做题,做个500多道就变牛了。其实,这既不是充分条件、也不会是必要条件。 我
2016-11-05 15:15:42 202
原创 Codeforces Round #410 (Div. 2) D. Mike and distribution
D. Mike and distributiontime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputMike has always been thinking abou
2017-05-17 19:12:24 211
转载 将0x3f3f3f3f设为无穷大的妙处
原文出处:http://blog.csdn.net/jiange_zh在算法竞赛中,我们常常需要用到一个“无穷大”的值,对于我来说,大多数时间我会根据具体问题取一个99999999之类的数(显得很不专业啊!)在网上看别人代码的时候,经常会看到他们把INF设为0x7fffffff,奇怪为什么设一个这么奇怪的十六进制数,一查才知道,因为这是32-bit int的最大值。如果这个无穷
2017-04-26 20:37:03 289
原创 岛屿3 HihoCoder - 1487
H国正在进行一项持续N周的填海造岛工程。整片工程海域可以被看作是1000x1000的网格。每周都有一块1x1的单位方格海域被填成陆地。如果我们将连成一片的陆地(一块单位方格与它上下左右4个单位方格是相连的)视为岛屿,H国想监测每周末整片海域中一共存在有多少个岛屿,以及这些岛屿的总面积和总周长各是多少。假设工程持续三周,第一周被填的海域坐标是(0, 0),那么第一周结束后有1座岛屿、总面积是
2017-03-31 22:50:34 368 1
原创 HDU 1879 继续畅通工程(最小生成树)
省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可)。现得到城镇道路统计表,表中列出了任意两城镇间修建道路的费用,以及该道路是否已经修通的状态。现请你编写程序,计算出全省畅通需要的最低成本。 Input测试输入包含若干测试用例。每个测试用例的第1行给出村庄数目N ( 1当N为0时输入结束。Output每个测
2017-03-14 21:16:36 206
原创 Leetcode 461. Hamming Distance
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,
2017-02-14 18:19:53 166
原创 基于VC6.0用MFC编写简易计算器
功能介绍:1> 标准型:能进行加、减、乘、除四则运算,具有清空、回退功能,还附加了添加小数点、化为百分数的功能。2> 科学型:新增了求三角函数(sin、cos、tan)、反三角函数(arcsin、arccos、arctan),取对数(ln、log10),π,求平方,求任意次方,求e的任意次方、10的任意次方,开平方,开任意次方,取模,求阶乘,取倒数的功能。3> 界面:添加了位图资源设置
2017-02-14 13:45:13 10660 11
原创 POJ 2632 Crashing Robots(模拟法)
In a modernized warehouse, robots are used to fetch the goods. Careful planning is needed to ensure that the robots reach their destinations without crashing into each other. Of course, all warehouses
2017-02-11 17:37:01 222
原创 POJ 1068 Parencodings(模拟法)
ParencodingsTime Limit:1000MS Memory Limit:10000KB 64bit IO Format:%lld & %lluSubmit Status Practice POJ 1068Appoint description: System Crawler (Nov 15, 2016 12:31:49 PM)
2016-11-18 18:58:29 228
原创 POJ 1577 Falling Leaves (二叉搜索树、先序遍历)
Falling LeavesTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 4638 Accepted: 2535Description Figure 1Figure 1 shows a graphical representation o
2016-11-18 18:30:00 495
原创 POJ 1521 Entropy(哈夫曼编码)
EntropyTime Limit:1000MS Memory Limit:10000KB 64bit IO Format:%lld & %lluSubmit Status Practice POJ 1521Appoint description: System Crawler (Oct 28, 2016 11:25:27 PM)D
2016-11-05 15:25:31 573
原创 HDU 1213 How Many Tables(并查集)
D - How Many TablesTime Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64uSubmit Status Practice _Appoint description: System Crawler (Nov 1, 2016 6:23:22 PM)
2016-11-02 23:14:18 166
原创 POJ 1328 Radar Installation(贪心法)
DescriptionAssume the coasting is an infinite straight line. Land is in one side of coasting, sea in the other. Each small island is a point locating in the sea side. And any radar installation, l
2016-10-15 19:44:43 221
原创 POJ 1700 Crossing River (贪心法)
DescriptionA group of N people wishes to go across a river with only one boat, which can at most carry two persons. Therefore some sort of shuttle arrangement must be arranged in order to row the
2016-10-10 20:06:47 296
原创 总纲
1. 搜索算法(BFS、DFS、剪枝算法…):2. 贪心:3. 动态规划:4. 二分:5. 图论:6. 并查集:7. 8.9.10.水题: 1000 2159
2016-10-07 22:57:51 171
原创 稀疏矩阵快速转置算法理解
稀疏矩阵:绝大多数元素为零的矩阵。稀疏矩阵的压缩储存:只储存稀疏矩阵中的非零元素,用三元式(row,col,value)唯一表示每一个非零元素的行 号、列号和值,按行\列顺序以一维数组的形式储存形成行\列三元组。快速转置算法的基本步骤:1. 计算每列非零元素个数,存入num[ ]中; 2. 计算每列第
2016-10-02 17:46:16 8437 1
原创 一般组合
输入n 个数,从中选出m 个数可构成集合,输出所有这样的集合。思路:采用递归(回溯)实现。使用了中间变量p,保证了每次选的数字在num 中的下标是递增的,所以也就不需要进行标记,共C(n, m)种组合。#include #define N 10using namespace std;int n, m; //从n个数中选出m个构成组合int rcd[N]; //记
2016-09-23 21:47:12 284
原创 Leetcode 237. Delete Node in a Linked List
Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.Supposed the linked list is 1 -> 2 -> 3 -> 4 and you are given the third node with value
2016-09-07 18:35:42 158
原创 Leetcode 242. Valid Anagram
Given two strings s and t, write a function to determine if t is an anagram of s.For example,s = "anagram", t = "nagaram", return true.s = "rat", t = "car", return false.Note:You may ass
2016-09-07 18:31:58 171
原创 Leetcode 349. Intersection of Two Arrays
Given two arrays, write a function to compute their intersection.Example:Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2].Note:Each element in the result must be unique.T
2016-09-06 19:47:16 130
原创 Leetcode 383. Ransom Note
Given an arbitrary ransom note string and another string containing letters from all the magazines, write a function that will return true if the ransom note can be constru
2016-09-05 20:58:08 162
原创 Leetcode 171. Excel Sheet Column Number
Given a column title as appear in an Excel sheet, return its corresponding column number.For example: A -> 1 B -> 2 C -> 3 ... Z -> 26 AA -> 27 AB -> 28 分析:实际上就是求这
2016-09-05 18:37:20 143
原创 Leetcode 283. Move Zeroes
283. Move Zeroes Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements.For example, given nums = [0, 1, 0,
2016-08-30 23:16:12 246
原创 Leetcode 258. Add Digits
258. Add Digits Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.For example:Given num = 38, the process is like: 3 + 8 = 11, 1
2016-08-30 20:06:01 159
原创 Leetcode 202. Happy Number
202. Happy NumberWrite an algorithm to determine if a number is "happy".A happy number is a number defined by the following process: Starting with any positive integer, replace the number
2016-08-30 19:15:04 156
原创 Leetcode 136. Single Number
136. Single Number Given an array of integers, every element appears twice except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could y
2016-08-29 23:21:14 132
原创 Leetcode 344. Reverse String
344. Reverse String QuestionEditorial Solution My SubmissionsTotal Accepted: 77975Total Submissions: 133714Difficulty: EasyWrite a function that takes a string as i
2016-08-29 20:49:57 130
原创 Leetcode 292. Nim Game
292. Nim Game QuestionEditorial Solution My SubmissionsTotal Accepted: 93357Total Submissions: 172788Difficulty: EasyYou are playing the following Nim Game with
2016-08-29 20:32:49 158
原创 Leetcode 389. Find the Difference
389. Find the Difference QuestionEditorial Solution My SubmissionsTotal Accepted: 5031Total Submissions: 9334Difficulty: EasyGiven two strings s and t which consist
2016-08-29 19:29:32 160
转载 并查集详解(转)
转载地址:http://blog.csdn.net/dellaserss/article/details/7724401/这位仁兄也是转载别人的发文,如果找到原作者一定会补上原出处的~~这个文章是几年前水acm的时候转的, 当时也不知道作者是谁, 要是有人知道的话说一下吧并查集是我暑假从高手那里学到的一招,觉得真是太精妙的设计了。以前我无法解决的
2016-08-27 00:10:23 184
原创 NOJ 1042 区间最值
区间最值Time Limit(Common/Java) : 1000 MS/ 3000 MS Memory Limit : 65536 KByteTotal Submit : 1151 Accepted : 268 Description给定一个长度不超过10000的整数序列,对这个序列有不超过500000个询问,每次询问给定
2016-08-12 18:44:45 296
原创 NOJ 1023 字符串排序
字符串排序Time Limit(Common/Java) : 1000 MS/ 3000 MS Memory Limit : 65536 KByteTotal Submit : 1706 Accepted : 415 Description有一些A、C、M组成的字符串,将其按字符A排序。Input
2016-08-12 17:38:55 335
原创 Leetcode 299. Bulls and Cows
299. Bulls and Cows QuestionEditorial Solution My SubmissionsTotal Accepted: 37002Total Submissions: 118547Difficulty: EasyYou are playing the following Bulls and C
2016-07-29 10:59:58 292
原创 HDU 1203 I NEED A OFFER! (基础动态规划)
I NEED A OFFER!Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 24474 Accepted Submission(s): 9845Problem DescriptionSpeakless
2016-07-28 22:49:56 180
原创 HDU 1003 Max Sum (动态规划)
Max SumTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 215061 Accepted Submission(s): 50603Problem DescriptionGiven a sequenc
2016-07-27 16:04:40 238
原创 Aggressiv cows(基础二分)
G - 基础二分Time Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64uSubmit StatusDescriptionFarmer John has built a new long barn, with N (2 His C (2 <= C <=
2016-07-11 23:27:04 258
原创 Codeforces Round #361 (Div. 2) C. Mike and Chocolate Thieves (二分法)
B - Mike and Chocolate ThievesTime Limit:2000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64uSubmit StatusDescriptionBad news came to Mike's village, some thieves sto
2016-07-11 23:18:22 246
原创 Codeforces Round #358 (Div. 2) A. Alyona and Numbers
A. Alyona and Numberstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAfter finishing eating her bun, Alyona
2016-07-10 22:18:20 215
原创 CodeForces 618 A. Slime Combining
A. Slime Combiningtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYour friend recently gave you some slime
2016-07-10 22:05:18 239
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人