自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

转载 康拓展开(维基百科)

via:https://zh.wikipedia.org/wiki/康托展开 康托展开是一个全排列到一个自然数的双射,常用于构建哈希表时的空间压缩。 康托展开的实质是计算当前排列在所有由小到大全排列中的顺序,因此是可逆的。 公式: 用途 显然,n位(0~n-1)全排列后,其康托展开唯一且最大约为n!,因此可以由更小的空间来储存这些排列。由公式可将X逆推出唯一的一个排列。 康托展开的逆运

2017-04-06 20:44:14 663

原创 八数码问题实现(裸BFS版+A*版)C++实现

算法核心是bfs hash用的是康拓展开 输入是第一行是初始状态,第二行是终止状态,空格用0表示。 012 345 ———> 012345678 678 一些测试数据: 012345678 102345678103425678 123405678123045678 123405678123475608 123405678123450678 12340567823415076

2017-03-22 11:51:58 2474 2

原创 递归生成格雷码 gray code generation using recursion(c++)

按序生成n位的全部格雷码 generate n digits grey code in order#include "iostream"#include "cstring"#include "cstdio"#include "string.h"#include "stack"#include "cmath"using namespace std;int n;char s[10500

2017-03-15 19:56:16 438

原创 HDU1029 Ignatius and the Princess IV 腾讯面试题抢红包(?)(模拟)

Problem Description “OK, you are not too bad, em… But you can never pass the next test.” feng5166 says.“I will tell you an odd number N, and then N integers. There will be a special integer among them

2017-03-09 16:56:39 627

原创 HDU 5546 Ancient Go (dfs)

Ancient GoTime Limit: 3000/1000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Others) Total Submission(s): 1804 Accepted Submission(s): 577Problem Description Yu Zhou likes to play Go with

2016-12-05 18:34:47 332

原创 HDU 5547 (DFS暴力)

#include "cstring"#include "cstdio"#include "string.h"#include "cstdio"#include "iostream"using namespace std;char mmap[10][10];int num_cnt[10];int row_cnt[10][10];int column_cnt[10][10];int

2016-12-03 16:28:52 326

原创 HDU4811 Ball 2013ACM/ICPC亚洲区南京站现场赛 (模拟乱搞)

BallTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2344 Accepted Submission(s): 983Problem Description Jenny likes balls. He has some ball

2016-11-30 18:14:32 854

原创 HDU 5573 Binary Tree 2015ACM/ICPC亚洲区上海站 (构造)

Binary TreeTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 998 Accepted Submission(s): 587 Special JudgeProblem Description The Old Frog K

2016-11-30 18:08:25 339

原创 HDU 5983 Pocket Cube ICPC亚洲区青岛站(模拟)

Pocket CubeTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 198 Accepted Submission(s): 70Problem Description The Pocket Cube, also known as

2016-11-30 17:10:38 1824 1

原创 HDU 4771 Stealing Harry Potter's Precious (bfs+dfs)

Stealing Harry Potter’s PreciousTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 3383 Accepted Submission(s): 1525Problem Description   Harr

2016-11-12 19:27:20 395

原创 HDU 4825 Xor Sum (01字典树)

Problem Description Zeus 和 Prometheus 做了一个游戏,Prometheus 给 Zeus 一个集合,集合中包含了N个正整数,随后 Prometheus 将向 Zeus 发起M次询问,每次询问中包含一个正整数 S ,之后 Zeus 需要在集合当中找出一个正整数 K ,使得 K 与 S 的异或结果最大。Prometheus 为了让 Zeus 看到人类的伟大,随即同意

2016-11-08 20:12:08 304

转载 最短路几种算法对比

来自:http://blog.csdn.net/basycia/article/details/50766436 Dijkstra: O(n2)适用于权值为非负的图的单源最短路径,用斐波那契堆的复杂度O(E+VlgV), BellmanFord: 适用于权值有负值的图的单源最短路径,并且能够检测负圈,复杂度O(VE) SPFA: 适用于权值有负值,且没有负圈的图的单源最短路径,论文中的复

2016-11-07 23:12:37 941

原创 HDU 1556 Color the ball (树状数组)

Color the ballTime Limit: 9000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 17610 Accepted Submission(s): 8814Problem Description N个气球排成一排,从左到右依次编号为1,2,3

2016-11-07 18:13:56 256

原创 POJ 2186 Dungeon Master (bfs)

Dungeon Master Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 28093 Accepted: 10969 DescriptionYou are trapped in a 3D dungeon and need to find the quickest way out! The dung

2016-11-06 22:41:55 280

原创 HDU 3887 Counting Offspring (树状数组+dfs)

Counting OffspringTime Limit: 15000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2688 Accepted Submission(s): 926Problem Description You are given a tree

2016-11-06 12:52:24 359

原创 HDU 5935 Car (模拟)

CarTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 590 Accepted Submission(s): 205Problem Description Ruins is driving a car to participati

2016-11-05 17:17:52 539

原创 HDU 5943 Kingdom of Obsession (二分图)

Kingdom of ObsessionTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 448 Accepted Submission(s): 127Problem Description There is a kindom of

2016-11-03 16:19:50 553

原创 HDU 5933 ArcSoft's Office Rearrangement (模拟)

ArcSoft’s Office RearrangementTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 457 Accepted Submission(s): 213Problem Description ArcSoft, I

2016-11-03 14:50:54 355

原创 HDU 5938 Four Operations (水题乱搞)

Four OperationsTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 413 Accepted Submission(s): 149Problem Description Little Ruins is a studiou

2016-11-02 12:51:17 687

原创 CodeForces 730J Bottles (DP 01背包)

Bottles Time Limit:2000MS Memory Limit:524288KB 64bit IO Format:%I64d & %I64u SubmitStatusPracticeCodeForces 730J Description Nick has n bottles of soda left after his birthday. Each bottle

2016-10-27 21:52:35 1276

原创 HDU 4614 Vases and Flowers (线段树)

Vases and FlowersTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others) Total Submission(s): 3169 Accepted Submission(s): 1254Problem Description   Alice is so popular

2016-10-27 19:29:26 277

原创 CodeForces 730G Car Repair Shop (优先队列乱搞)

Car Repair Shop Time Limit: 2000MS Memory Limit: 524288KB 64bit IO Format: %I64d & %I64u SubmitStatusDescription Polycarp starts his own business. Tomorrow will be the first working day of

2016-10-27 19:26:21 861

原创 HDU 1540 Tunnel Warfare (线段树)

Tunnel WarfareTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 7442 Accepted Submission(s): 2901Problem Description During the War of Resist

2016-10-24 22:51:20 301

原创 HDU 4027 Can you answer these queries? (线段树)

Can you answer these queries?Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65768/65768 K (Java/Others) Total Submission(s): 14079 Accepted Submission(s): 3269Problem Description A lot of

2016-10-22 17:48:47 322

原创 POJ 3264 Balanced Lineup (线段树)

Balanced Lineup Time Limit:5000MS Memory Limit:65536KB 64bit IO Format:%lld & %llu SubmitStatusPracticePOJ 3264 Description For the daily milking, Farmer John’s N cows (1 ≤ N ≤ 50,000) alwa

2016-10-20 22:46:00 237

原创 CodeForces 17E Palisection (回文树)

Palisection time limit per test2 seconds memory limit per test128 megabytes inputstandard input outputstandard output In an English class Nick had nothing to do at all, and remembered about wonder

2016-10-09 22:08:51 389

原创 HDU 5658 CA Loves Palindromic (回文树)

CA Loves PalindromicTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others) Total Submission(s): 374 Accepted Submission(s): 161Problem Description CA loves strings,

2016-10-04 13:40:00 666

原创 URAL 1960 Palindromes and Super Abilities (回文树)

Palindromes and Super Abilities Time Limit: 1000MS Memory Limit: 65536KB 64bit IO Format: %I64d & %I64u SubmitStatusDescription After solving seven problems on Timus Online Judge with a w

2016-10-04 10:59:10 335

转载 回文树模板

原文链接: http://blog.csdn.net/u013368721/article/details/42100363 回文树可以: 1.求串S前缀0~i内本质不同回文串的个数(两个串长度不同或者长度相同且至少有一个字符不同便是本质不同) 2.求串S内每一个本质不同回文串出现的次数 3.求串S内回文串的个数(其实就是1和2结合起来) 4.求以下标i结尾的回文串的个数那么我们该如何构

2016-10-03 20:38:26 397

原创 UVA 7041 The Problem to Slow Down You (回文树)

The Problem to Slow Down YouAfter finishing his homework, our problem setter Federmann decided to kill time by hanging around online. He found a cool chat room that discusses competitive programming. F

2016-10-03 20:32:03 542

原创 CodeForces 716D Complete The Graph (SPFA)

Complete The Graph Time Limit: 4000MS Memory Limit: 262144KB 64bit IO Format: %I64d & %I64u SubmitStatusDescription ZS the Coder has drawn an undirected graph of n vertices numbered from 0

2016-10-01 20:42:55 407

原创 CSU 1804 有向无环图 (拓扑排序+乱搞)

有向无环图 Time Limit: 5000MS Memory Limit: 131072KB 64bit IO Format: %lld & %llu SubmitStatusDescription Bobo 有一个 n 个点,m 条边的有向无环图(即对于任意点 v,不存在从点 v 开始、点 v 结束的路径)。 为了方便,点用 1,2,…,n 编号。 设 count(x

2016-09-27 16:50:07 750 2

原创 斐波那契数的栈模拟递归算法

斐波那契数的栈模拟递归算法 设计模式作业。。瞎搞一波。#include "cstring"#include "cstdio"#include "string.h"#include "iostream"#include "stack"using namespace std;typedef struct node{ int n,value,flag;}node;node ma

2016-09-25 19:58:38 1230 1

原创 LightOJ 1017 Brush (III) (DP)

Brush (III) Time Limit:2000MS Memory Limit:32768KB 64bit IO Format:%lld & %llu SubmitStatus Description Samir returned home from the contest and got angry after seeing his room dusty. Who l

2016-09-25 19:17:59 218

原创 欧拉函数相关知识

模板://筛选法打欧拉函数表 #define Max 1000001 int euler[Max]; void Init(){ euler[1]=1; for(int i=2;i<Max;i++) euler[i]=i; for(int i=2;i<Max;i++) if(

2016-09-21 21:31:52 221

原创 UVA 11424 UVA 11424 GCD - Extreme (I) (欧拉函数)

Given the value of N, you will have to find the value of G. The definition of G is given below: i#include "cstring"#include "cstdio"#include "string.h"#include "iostream"using namespace std;#defin

2016-09-21 21:25:10 546

转载 欧拉图相关知识

百度百科摘的。欧拉图 1、定义:经过图(无向图或有向图)中每条边一次切近义词并且行遍图中每个定点的回路(通路),成为欧拉回路(欧拉通路),存在欧拉回路的图称为欧拉图。 2、相关定理相关定理: 1.无向连通图G是欧拉图,当且仅当G不含奇数度结点(G的所有结点度数为偶数); 2.无向连通图G含有欧拉通路,当且仅当G有零个或两个奇数度的结点; 3.有向连通图D是欧拉图,当且仅当该图为连通图且D中

2016-09-20 10:54:58 761

原创 POJ 1459 Power Network (网络流)

Power Network Time Limit: 2000MS Memory Limit: 32768K Total Submissions: 27278 Accepted: 14176 DescriptionA power network consists of nodes (power stations, consumers and dispatchers) co

2016-09-20 10:51:41 219

原创 POJ 1273 Drainage Ditches (网络流)

Drainage Ditches Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 70372 Accepted: 27358 DescriptionEvery time it rains on Farmer John’s fields, a pond forms over Bessie’s favor

2016-09-19 21:23:32 249

原创 HDU 5898 odd-even number (数位DP) 2016 ACM/ICPC Asia Regional Shenyang Online

odd-even numberTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 220 Accepted Submission(s): 115Problem Description For a number,if the lengt

2016-09-19 11:21:06 355

空空如也

空空如也

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

TA关注的人

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