- 博客(56)
- 收藏
- 关注
原创 Netty(一)Netty简介与Java的IO模型
Netty是由JBOSS提供的一个Java开源框架,现为Github上的独立项目。Netty是一个异步的、基于事件驱动的网络应用框架,用以快速开发高性能、高可靠性的网络IO程序Netty主要针对在TCP环境下,面向Clients端的高并发应用,或者P2P场景下的大量数据持续传输的应用Netty的本质是一个NIO框架,适用于服务器通讯相关的多种应用场景Netty框架基于TCP/IP协议,在原生的JDK IO、网络的基础上使用NIO对IO、网络进行的封装优化的框架。
2023-11-01 16:31:37
302
原创 数据结构实验之查找三:树的种类统计
数据结构实验之查找三:树的种类统计 #include <iostream> #include <cstring> #include <cstdio> #include <algorithm> using namespace std; struct tree { int cou; char a[20+5]; tree *l,...
2019-05-21 18:19:15
270
原创 JAVA获取网页源码并写入html文件
package pac; import java.io.*; import java.net.HttpURLConnection; import java.net.URL; public class Main { public static class HttpTest { private String u; private String encoding; HttpTest
2017-12-01 15:45:30
2803
原创 数据结构实验之查找二:平衡二叉树
#include #include #include #include using namespace std; struct bst { int d; bst *l,*r; int deep; bst() { l=r=NULL; deep=0; } }; int deept(bst *p) { if(!p)
2016-12-07 11:02:00
431
原创 数据结构实验之排序三:bucket sort
#include #include #include using namespace std; int a[100+5]; int main() { int n; while(~scanf("%d", &n)) { memset(a,0,sizeof(a)); while(n--) { int x;
2016-12-03 21:38:53
484
原创 数据结构实验之查找四:二分查找
#include #include #include using namespace std; int a[10000000+5]; int n, m, key; int fin(int i, int j) { if(i>j) return -1; int mid=(i+j)/2; if(a[mid]==key) return mid-1;
2016-11-23 11:19:28
829
原创 数据结构实验之查找一:二叉排序树
#include using namespace std; struct tree { int data; tree *l, *r; tree() { l=r=NULL; } }; int x; bool f; tree *insert(tree *root) { if(!root) { root=
2016-11-23 10:48:00
659
原创 数据结构实验之图论四:迷宫探索
数据结构实验之图论四:迷宫探索 Time Limit: 1000MS Memory Limit: 65536KB Submit Statistic Problem Description 有一个地下迷宫,它的通道都是直的,而通道所有交叉点(包括通道的端点)上都有一盏灯和一个开关;请问如何从某个起点开始在迷宫中点亮所有的灯并回到起点? Input 连续T组数据输入,
2016-11-14 11:33:57
412
原创 数据结构实验之图论六:村村通公路
数据结构实验之图论六:村村通公路 Time Limit: 1000MS Memory Limit: 65536KB Submit Statistic Problem Description 当前农村公路建设正如火如荼的展开,某乡镇政府决定实现村村通公路,工程师现有各个村落之间的原始道路统计数据表,表中列出了各村之间可以建设公路的若干条道路的成本,你的任务是根据给出的数据表,求
2016-11-09 17:39:11
543
原创 数据结构实验图论一:基于邻接矩阵的广度优先搜索遍历
数据结构实验图论一:基于邻接矩阵的广度优先搜索遍历 Time Limit: 1000MS Memory Limit: 65536KB Submit Statistic Problem Description 给定一个无向连通图,顶点编号从0到n-1,用广度优先搜索(BFS)遍历,输出从某个顶点出发的遍历序列。(同一个结点的同层邻接点,节点编号小的优先遍历) Input
2016-11-09 11:32:41
554
原创 树结构练习——判断给定森林中有多少棵树
树结构练习——判断给定森林中有多少棵树 Time Limit: 1000MS Memory Limit: 65536KB Submit Statistic Problem Description 众人皆知,在编程领域中,C++是一门非常重要的语言,不仅仅因为其强大的功能,还因为它是很多其他面向对象语言的祖先和典范。不过这世上几乎没什么东西是完美的,C++也不例外,多继承结构在带来
2016-11-09 11:21:31
554
原创 数据结构实验:连通分量个数
数据结构实验:连通分量个数 Time Limit: 1000MS Memory Limit: 65536KB Submit Statistic Problem Description 在无向图中,如果从顶点vi到顶点vj有路径,则称vi和vj连通。如果图中任意两个顶点之间都连通,则称该图为连通图, 否则,称该图为非连通图,则其中的极大连通子图称为连通分量,这里所谓的极大是指子图
2016-11-09 11:17:22
415
原创 图的深度遍历
图的深度遍历 Time Limit: 1000MS Memory Limit: 65536KB Submit Statistic Problem Description 请定一个无向图,顶点编号从0到n-1,用深度优先搜索(DFS),遍历并输出。遍历时,先遍历节点编号小的。 Input 输入第一行为整数n(0 Output 输出有n行,对应n组输出,每行为
2016-11-09 10:59:52
479
原创 数据结构实验之二叉树六:哈夫曼编码
#include #include #include #include #include using namespace std; int main() { char s[1000+5]; int vis[150+5]; while(~scanf("%s", s)) { memset(vis,0,sizeof(vis)); int
2016-11-04 21:21:00
453
原创 POJ 2513 Colored Sticks
Language: Default Colored Sticks Time Limit: 5000MS Memory Limit: 128000K Total Submissions: 36032 Accepted: 9427 Description You are given a bunch of wooden stic
2016-11-01 20:39:29
416
原创 数据结构实验之串三:KMP应用
数据结构实验之串三:KMP应用 Time Limit: 1000MS Memory Limit: 65536KB Submit Statistic Problem Description 有n个小朋友,每个小朋友手里有一些糖块,现在这些小朋友排成一排,编号是由1到n。现在给出m个数,能不能唯一的确定一对值l和r(l Input 首先输入一个整数n,代表有n个
2016-10-26 10:43:32
433
原创 数据结构实验之二叉树四:还原二叉树
数据结构实验之二叉树四:还原二叉树 Time Limit: 1000MS Memory Limit: 65536KB Submit Statistic Problem Description 给定一棵二叉树的先序遍历序列和中序遍历序列,要求计算该二叉树的高度。 Input 输入数据有多组,每组数据第一行输入1个正整数N(1 为树中结点总数,随后2行先后给出先序和中
2016-10-20 13:59:24
481
原创 数据结构实验之二叉树三:统计叶子数
数据结构实验之二叉树三:统计叶子数 Time Limit: 1000MS Memory Limit: 65536KB Submit Statistic Problem Description 已知二叉树的一个按先序遍历输入的字符序列,如abc,,de,g,,f,,, (其中,表示空结点)。请建立二叉树并求二叉树的叶子结点个数。 Input 连续输入多组数据,每组数
2016-10-13 17:48:32
407
原创 数据结构实验之二叉树二:遍历二叉树
数据结构实验之二叉树二:遍历二叉树 Time Limit: 1000MS Memory Limit: 65536KB Submit Statistic Problem Description 已知二叉树的一个按先序遍历输入的字符序列,如abc,,de,g,,f,,, (其中,表示空结点)。请建立二叉树并按中序和后序的方式遍历该二叉树。 Input 连续输入多组数据
2016-10-13 17:46:24
643
原创 数据结构实验之串二:字符串匹配
数据结构实验之串二:字符串匹配 Time Limit: 1000MS Memory Limit: 65536KB Submit Statistic Problem Description 给定两个字符串string1和string2,判断string2是否为string1的子串。 Input 输入包含多组数据,每组测试数据包含两行,第一行代表str
2016-10-13 17:40:33
471
原创 数据结构实验之串一:KMP简单应用
数据结构实验之串一:KMP简单应用 Time Limit: 1000MS Memory Limit: 65536KB Submit Statistic Problem Description 给定两个字符串string1和string2,判断string2是否为string1的子串。 Input 输入包含多组数据,每组测试数据包含两行,第一行代表string1(长度小
2016-10-13 17:39:08
417
原创 数据结构实验之二叉树七:叶子问题
数据结构实验之二叉树七:叶子问题 Time Limit: 1000MS Memory Limit: 65536KB Submit Statistic Problem Description 已知一个按先序输入的字符序列,如abd,,eg,,,cf,,,(其中,表示空结点)。请建立该二叉树并按从上到下从左到右的顺序输出该二叉树的所有叶子结点。 Input 输入数据
2016-10-12 11:12:15
331
原创 顺序表应用7:最大子段和之分治递归法
顺序表应用7:最大子段和之分治递归法 Time Limit: 10MS Memory Limit: 400KB Submit Statistic Problem Description 给定n(1当所给的整数均为负数时定义子段和为0,依此定义,所求的最优值为: Max{0,a[i]+a[i+1]+…+a[j]},1<=i<=j<=n。 例如,当(a[1],a[2],a[3],a[
2016-10-02 22:13:25
461
原创 顺序表应用3:元素位置互换之移位算法
01 #include 02 using namespace std; 03 class List { 04 private: 05 int *elem; 06 int siz
2016-10-02 12:50:09
505
原创 数据结构实验之链表九:双向链表 C++
01 #include 02 using namespace std; 03 class linklist { 04 private: 05 class linknode { 06
2016-10-01 18:31:05
1008
原创 数据结构实验之链表八:Farey序列 C++
view source print? 01 #include 02 using namespace std; 03 class linklist { 04 private: 05 class
2016-10-01 18:12:06
1410
原创 数据结构实验之链表七:单链表中重复元素的删除 c++练习
#include #include using namespace std; class linklist { private: class linknode { public: int data; linknode *next; linknode():next(NULL) {} linknod
2016-10-01 17:44:54
1281
原创 c++链表
带tail尾指针的写法: 1 #include 02 using namespace std; 03 class linklist { 04 private: 05 clas
2016-10-01 15:47:34
388
原创 POJ 3020 Antenna Placement
Source Code #include #include using namespace std; int map[40+5][10+5], next[4][2]={{1,0},{-1,0},{0,1},{0,-1}}; int a[400+5][400+5], match[400+5]; bool vis[400+5]; int k; bool fin(int x) { for(
2016-08-09 15:32:26
356
原创 POJ 3041 Asteroids
#include #include #include using namespace std; int n, m, in[200+5], q[200+5], k; bool map[200+5][200+5]; int toposort() { int flag, temp[200+5]; for(int i=1;i temp[i]=in[i
2016-08-03 20:59:17
379
原创 POJ 3267 The Cow Lexicon
The Cow Lexicon Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 9759 Accepted: 4678 Description Few know that the cows have their own dictionary with W (1
2016-08-03 20:08:04
323
原创 POJ 2488 A Knight's Journey
A Knight's Journey Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 41039 Accepted: 13964 Description Background The knight is getting bored of seeing the
2016-08-03 10:44:47
324
原创 POJ 3083 C - Children of the Candy Corn
#include #include #include #include using namespace std; int sx, sy, ex, ey, d1,d2, n, m, next[4][2]={{-1,0},{0,1},{1,0},{0,-1}}; char s[40+5][40+5]; struct node { int x, y, step; };
2016-08-02 10:36:51
803
原创 未过代码求解 POJ 1062 昂贵的婚礼
昂贵的聘礼 Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 45065 Accepted: 13314 Description 年轻的探险家来到了一个印第安部落里。在那里他和酋长的女儿相爱了,于是便向酋长去求亲。酋长要他用10000个金币作为聘礼才答应把女儿嫁给
2016-07-28 20:01:49
447
原创 POJ 2956 The Pilots Brothers' refrigerator
The Pilots Brothers' refrigerator Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 23729 Accepted: 9147 Special Judge Description The game “The Pilots
2016-07-26 11:19:04
545
原创 POJ 1753 Flip Game
Flip Game Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 39989 Accepted: 17358 Description Flip game is played on a rectangular 4x4 field with two-sided p
2016-07-26 10:00:04
468
原创 POJ 1611 The Suspects
The Suspects Time Limit: 1000MS Memory Limit: 20000K Total Submissions: 32952 Accepted: 15977 Description Severe acute respiratory syndrome (SARS), an atypical pneumo
2016-07-25 19:11:46
511
原创 POJ 3026 Borg Maze
Borg Maze Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 12469 Accepted: 4083 Description The Borg is an immensely powerful race of enhanced humanoids fro
2016-07-25 14:54:59
515
原创 贪心算法小白の人品测试
http://acm.sdut.edu.cn/sdutoj/showproblem.php?pid=3555&cid=1755 小白の人品测试 Time Limit: 1000MS Memory limit: 65536K 题目描述 现在有n个人,编号从1到n ,每个人有一个 人品值 这是一个赤裸裸的金钱关系的世界 如果小白想要小黑直接帮他一
2016-06-01 13:01:21
779
原创 SDUT 1489 求二叉树的先序遍历
http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=1489 求二叉树的先序遍历 Time Limit: 1000ms Memory limit: 65536K 有疑问?点这里^_^ 题目描述 已知一棵二叉树的中序遍历和后序遍历,求二叉树的先序遍
2016-05-21 16:54:52
599
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人