自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 八大排序总结

1. 插入排序—直接插入排序(Straight Insertion Sort)顾名思义,直接插入排序就是将一个记录插入一个已经排好序的数组中,使原本排好序的数组添加了一个记录并且继续保持排好序。如果在比较时两个记录相等,则把插入的记录放到原先记录的后面,所以插入排序是稳定的。时间复杂度:O(n^2)。void InsertSort(int a[], int n) {

2017-08-03 19:51:13 264

原创 单链表寻找环,寻找环的入口点

1. 单链表找环(下边图片来自网上) 设置一快一慢的指针,从链表的起点(即 A 点)开始跑,快指针(fast)一次跑两步,慢指针(slow)一次跑一步。① 当没有环时,快指针最终会到达 null (fast == null)。② 但有环时,但慢指针到达环的入口点时(即 E 点),快指针已经进入了环并在循环中。因此,快指针一定会在慢指针到达环的入口点(即 E 点)前相遇。代码如下

2017-08-02 00:40:38 706 1

原创 ubuntu 中文件编码转换

在Ubuntu安装了eclipse并打开从GitHUb上下载了一些Java项目,居然全部都出现中文乱码,然后我检查了eclipse里边的编码设置,从workspace到具体项目中,编码设置全都为utf-8,但是我的代码依旧出现乱码,后来我发现了问题的根源在于项目里边的Java文件原来设置的编码不是utf-8,是什么我就不知道,于是我安装了一个叫enca的东西,把文件编码都改为utf-8,就解决了问

2017-04-07 00:07:32 751

转载 JavaScript this 的用法

http://www.cnblogs.com/pssp/p/5216085.html

2017-03-15 00:35:43 271

转载 DateTime用法大全

本文较详细地介绍了C#的DateTime对象的使用方法.DateTime.Now.ToShortTimeString() DateTime dt = DateTime.Now; dt.ToString();//2005-11-5 13:21:25 dt.ToFileTime().ToString();//127756416859912816 dt.ToFileTimeUtc().ToString(

2017-01-23 10:40:40 1350

原创 UVa 11997 K Smallest Sums (优先队列)

题意:有 k 个整数数组,各包含 k 个元素。在每个数组中取一个元素加起来,可以得到哦 k^k 个和。求这些和中最小的 k 个值(重复的值算多次)思路:在《算法竞赛入门经典训练指南》中看到这道题,再自己写一写思路,加深理解。           从 k 个数组中各取一个元素之和中前 k 个最小的值为 k 个组合,则这 k 个组合一定来自前 k - 1 个数组中各取一个元素之和中前 k 个最

2016-04-08 20:54:36 408

转载 map的详细用法

原创网址:http://blog.csdn.net/sunshinewave/article/details/8067862

2016-04-08 00:52:40 401

转载 使用System.arraycopy()实现数组之间的复制

System提供了一个静态方法arraycopy(),我们可以使用它来实现数组之间的复制。其函数原型是: public static void arraycopy(Object src, int srcPos, Object dest, int destPos, int length) src:源数组; srcPos:源数组要复制的起始位置; dest:目的数组; destPos:目的数组放置

2016-04-03 21:19:18 314

转载 对于String对象,可以使用"="赋值,也可以使用"new"关键字赋值,两种方式有什么区别?

本文转自http://www.cnblogs.com/hongten/p/hongten_string_qubie.html当你看见这个标题的时候,你可能会下意识的去想一下,这两种方式到底有什么样的区别呢?且看下面的demo,自然便区分开了 1 /** 2 * 3 */ 4 package com.b510.test; 5 6 /** 7 * Pr

2016-04-02 23:44:31 697

原创 POJ 2001 Shortest Prefixes(字典树)

Shortest PrefixesTime Limit: 1000MS Memory Limit: 30000KB 64bit IO Format: %I64d & %I64uDescriptionA prefix of a string is a substring starting at the beginni

2015-10-27 13:19:51 410

原创 UVA 1401 Remember the Word (trie + dp)

第一次写trie, 看别人的代码看懂的,顺便学了一下dp。#include #include #include #include #define mod 20071027;using namespace std;char str[300010], s[110];int dp[300010];struct Trie{ int ch[400010][26]; i

2015-10-24 19:05:34 360

原创 HDU 5416 CRB and Tree(dfs 异或逆运算)

CRB and TreeTime Limit: 8000/4000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 760    Accepted Submission(s): 248Problem DescriptionCRB has a tree,

2015-08-22 00:45:45 652

原创 ZOJ 3790 Consecutive Blocks(尺取法)

Consecutive BlocksTime Limit: 2 Seconds      Memory Limit: 65536 KBThere are N (1 ≤ N ≤ 105) colored blocks (numbered 1 to N from left to right) which are lined up in a row. And the i-th block

2015-08-21 18:17:24 369

原创 POJ 1961 (KMP)

PeriodTime Limit: 3000MS Memory Limit: 30000KTotal Submissions: 14739 Accepted: 7015DescriptionFor each prefix of a given string S with N characters (each charact

2015-08-16 23:25:26 265

原创 Light OJ 1422 Halloween Costumes(区间DP)

1422 - Halloween CostumesPDF (English)StatisticsForumTime Limit: 2 second(s)Memory Limit: 32 MBGappu has a very busy weekend ahead of him. Because, next

2015-08-08 16:01:37 906

原创 567D One-Dimensional Battle Ships(set)

D. One-Dimensional Battle Shipstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAlice and Bob love playing o

2015-08-08 11:57:58 381

原创 codeforces 567C Geometric Progression

C. Geometric Progressiontime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputPolycarp loves geometric progressio

2015-08-07 15:54:56 404

原创 HDU 5353 Average(枚举)

AverageTime Limit: 4000/2000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 678    Accepted Submission(s): 174Special JudgeProblem DescriptionThere

2015-08-06 23:00:19 308

原创 UVA 10765 (割点)

题意:给出一个无向图,求出鸽子值,鸽子值即是每删除一个点后有多少个连通块。思路:求割点,与割点相连的连通分量就是割点的鸽子值,非割点的点的鸽子值均为1。#include #include #include #include #include #include #include #include #include using namespace std;vec

2015-08-03 13:57:41 413

原创 POJ 1144(求割点数)

NetworkTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 10624 Accepted: 4915DescriptionA Telephone Line Company (TLC) is establishing a new telephone cab

2015-08-02 19:18:31 298

转载 HDU 1394 Minimum Inversion Number (线段数)

Minimum Inversion NumberTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 13951    Accepted Submission(s): 8519Problem Description

2015-07-31 14:47:34 345

原创 HDU 5336 XYZ and Drops(bfs)

XYZ and DropsTime Limit: 3000/1500 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 736    Accepted Submission(s): 203Problem DescriptionXYZ is playing

2015-07-31 13:06:14 522

原创 UVALive 6800 The Mountain of Gold (bellman_ford判负环)

题意:给出一个有向图,问从0出发后能不能重新回到0并且总边权和为负。思路:以0为起点,用bellman_ford找负环,如果有负环,则说明0能走到负环,然后能再找一条从负环到0的路,则实现要求,因为在负权里可以多走几圈保证总边权为负。如何找有没有从负环到0的路:如果有负环,再跑一遍询问,如果进行松弛,则说明边的起点在负环内或负环能到达的点,把这些点标记,然后再扫一遍原来的边,如果边的起点和终点

2015-07-30 10:42:02 481

转载 HDU 5305 Friends (DFS)

FriendsTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 163    Accepted Submission(s): 61Problem DescriptionThere are n people

2015-07-23 22:12:28 297

原创 HDU 5294 Tricks Device(最短路+最小割)

Tricks DeviceTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1033    Accepted Submission(s): 250Problem DescriptionInnocent Wu follo

2015-07-22 17:18:19 375

原创 HDU 5288 OO’s Sequence (二分查找)

OO’s SequenceTime Limit: 4000/2000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 569    Accepted Submission(s): 205Problem DescriptionOO has got a arr

2015-07-21 21:42:53 407

原创 HDU 5285 wyh2000 and pupil(染色法判断二分图)

wyh2000 and pupilTime Limit: 3000/1500 MS (Java/Others)    Memory Limit: 131072/65536 K (Java/Others)Total Submission(s): 794    Accepted Submission(s): 260Problem DescriptionYoung theoret

2015-07-20 17:43:54 821

原创 ZOJ 3620 Information(强联通分量)

InformationTime Limit: 2 Seconds      Memory Limit: 32768 KB It is a war between Country Alpha and Country Beta. Country Alpha gets following information about Country Beta:Country Beta ha

2015-07-20 16:04:45 434

原创 POJ 3311 Hie with the Pie(状态压缩DP)

Hie with the PieTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 5323 Accepted: 2849DescriptionThe Pizazz Pizzeria prides itself in delivering pizzas to

2015-07-17 10:18:30 274

原创 CodeForces 349B Color the Fence(完全背包)

B. Color the Fencetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputIgor has fallen in love with Tanya. Now

2015-07-15 20:30:29 443

原创 HDU 4496 D-City(并查集)

D-CityTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 2401    Accepted Submission(s): 841Problem DescriptionLuxer is a really ba

2015-05-31 18:40:44 394

原创 Aizu 2251 Merry Christmas(二分图最大匹配+Floyd)

Merry ChristmasTime Limit : 8 sec, Memory Limit : 65536 KBProblem J: Merry ChristmasInternational Christmas Present Company (ICPC) is a company to employ Santa and deliver presents o

2015-05-30 12:23:39 518

原创 zoj 3646 matrix transformer (二分匹配)

Matrix TransformerTime Limit: 2 Seconds      Memory Limit: 65536 KBAlice and Bob meet again. This time they play a game named MATRIX TRANSFORMER.They got an n * n board. Every grid has two p

2015-05-30 10:52:09 298

空空如也

空空如也

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

TA关注的人

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