自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(193)
  • 资源 (2)
  • 收藏
  • 关注

原创 Java面经

文章目录项目问题数据回流架构数据流图设计总结成果你这个项目的QPS、订单量有多少如何解决超卖问题假如让你设计一个秒杀系统,怎么设计才能承受百万级并发秒杀系统场景特点秒杀架构设计理念架构方案设计思路前端方案浏览器端(js):后端方案服务端控制器层(网关层)服务层数据库层讲讲数据库表怎么设计的为什么使用自增字段作主键spring里面的控制反转,IoC高频搜索关键词,每个文件1G,每个文件有多行 TopK问题一个列表,找出最长的字串,满足字串的每个元素相差不超过limitjwt优缺点优点缺点使用场景虚函数是什么逻

2021-10-16 22:04:08 2046

原创 二分法控制精度

#include<stdio.h>const double EPSINON=1e-10;// 二分法控制精度 例子:求sqrt(2) 的精确值int main(){ double low=1.4; double high=1.5; double mid=(low+high)/2; while (high-low>EPSINON){...

2019-06-17 16:00:07 1985 1

原创 牛客网 成绩排序

题目描述查找和排序题目:输入任意(用户,成绩)序列,可以获得成绩从高到低或从低到高的排列,相同成绩      都按先录入排列在前的规则处理。   例示:   jack      70   peter     96   Tom       70   smith     67   从高到低  成绩               peter     96       jack      70       ...

2018-03-06 15:35:16 862 3

原创 盛大游戏杯 调和序列

       这次的题目用的是截图,我没有它的文档版,只是看这个题目有意思,发一下,自己也练习使用了vector,题目主要的思路就是构建序列+降序排序,题目卡人的地方就是对边界的处理,判断s与序列中元素个数的大小#include&lt;stdio.h&gt;#include&lt;string.h&gt;#include&lt;stdlib.h&gt;#include&lt;iostream...

2018-02-25 17:04:23 328

原创 Poj 2318 TOYS

TOYSTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 17117 Accepted: 8175DescriptionCalculate the number of toys that land in each bin of a partitioned toy box. Mom and dad have a problem - t...

2018-02-19 16:24:38 199

原创 哈夫曼编码与解码

#include#include#include#define MAXNUM 60typedef struct{char ch;int weight; //权值,这个字符出现的频率int parent;int left;int right;}HuffNode;typedef struct{char code[MAXNUM];int start;}HuffCode

2018-01-09 17:42:17 1362 1

原创 poj 2299 Ultra-QuickSort

DescriptionIn this problem, you have to analyze a particular sorting algorithm. The algorithm processes a sequence of n distinct integers by swapping two adjacent sequence elements until the seque

2017-05-03 17:12:22 295

原创 poj 2337 Catenyms

DescriptionA catenym is a pair of words separated by a period such that the last letter of the first word is the same as the last letter of the second. For example, the following are catenyms: d

2017-05-03 11:41:01 254

原创 poj 1386 Play on Words

DescriptionSome of the secret doors contain a very interesting word puzzle. The team of archaeologists has to solve it to open that doors. Because there is no other way to open the doors, the puzz

2017-05-03 09:49:04 293

原创 常用小方法整理3

错排公式n各有序的元素应有n!种不同的排列。如若一个排列式的所有的元素都不在原来的位置上,则称这个排列为错排。核心递推公式:D(n) = (n-1) [D(n-2) + D(n-1)]特殊地,D(1) = 0, D(2) = 1.欧拉回路的判定一.无向图一个无向图存在欧拉路径,当且仅当 该图所有顶点的度数为偶数 或者 除了两个度数为奇数外其余的全是偶数。

2017-05-03 09:47:28 260

原创 poj 2230 Watchcow

DescriptionBessie's been appointed the new watch-cow for the farm. Every night, it's her job to walk across the farm and make sure that no evildoers are doing any evil. She begins at the barn, mak

2017-05-03 09:25:47 219

转载 高精度模板 大数的基本运算

#include #include #include #include #include #include using namespace std;const int MAXN = 410; //数字的最大长度,根据情况自己调整struct bign{ int len, s[MAXN]; bign () { memset(s, 0, sizeof(s));

2017-05-02 15:59:30 228

原创 蓝桥杯 分巧克力

儿童节那天有K位小朋友到小明家做客。小明拿出了珍藏的巧克力招待小朋友们。小明一共有N块巧克力,其中第i块是Hi x Wi的方格组成的长方形。为了公平起见,小明需要从这 N 块巧克力中切出K块巧克力分给小朋友们。切出的巧克力需要满足:1. 形状是正方形,边长是整数 2. 大小相同 例如一块6x5的巧克力可以切出6块2x2的巧克力或者2块3x3的巧克力。当然小朋

2017-05-02 15:06:05 376

原创 poj 3468 A Simple Problem with Integers

DescriptionYou have N integers, A1, A2, ... , AN. You need to deal with two kinds of operations. One type of operation is to add some given number to each number in a given interval. The other is

2017-04-25 21:14:10 217

转载 hdu 1394 Minimum Inversion Number

Problem DescriptionThe inversion number of a given number sequence a1, a2, ..., an is the number of pairs (ai, aj) that satisfy i aj.For a given sequence of numbers a1, a2, ..., an, if we mov

2017-04-25 20:22:36 245

原创 poj 1325 Machine Schedule

DescriptionAs we all know, machine scheduling is a very classical problem in computer science and has been studied for a very long history. Scheduling problems differ widely in the nature of the c

2017-04-20 21:30:08 224

原创 poj 2446 Asteroids

DescriptionBessie wants to navigate her spaceship through a dangerous asteroid field in the shape of an N x N grid (1 Fortunately, Bessie has a powerful weapon that can vaporize all the astero

2017-04-20 21:04:09 225

原创 poj 2239 Selecting Courses

DescriptionIt is well known that it is not easy to select courses in the college, for there is usually conflict among the time of the courses. Li Ming is a student who loves study every much, and

2017-04-20 20:35:05 234

原创 poj 1469 COURSES

DescriptionConsider a group of N students and P courses. Each student visits zero, one or more than one courses. Your task is to determine whether it is possible to form a committee of exactly P s

2017-04-19 20:59:19 186

原创 HDU 1272 小希的迷宫

Problem Description上次Gardon的迷宫城堡小希玩了很久(见Problem B),现在她也想设计一个迷宫让Gardon来走。但是她设计迷宫的思路不一样,首先她认为所有的通道都应该是双向连通的,就是说如果有一个通道连通了房间A和B,那么既可以通过它从房间A走到房间B,也可以通过它从房间B走到房间A,为了提高难度,小希希望任意两个房间有且仅有一条路径可以相通(除非走了回头路

2017-04-17 20:30:27 199

原创 poj 1797 Heavy Transportation

DescriptionBackground Hugo Heavy is happy. After the breakdown of the Cargolifter project he can now expand business. But he needs a clever man who tells him whether there really is a way from t

2017-04-14 21:25:07 261

原创 poj 1251 Jungle Roads

DescriptionThe Head Elder of the tropical island of Lagrishan has a problem. A burst of foreign aid money was spent on extra roads between villages some years ago. But the jungle overtakes roa

2017-04-13 21:53:17 205

原创 poj 2387 Til the Cows Come Home

Bessie is out in the field and wants to get back to the barn to get as much sleep as possible before Farmer John wakes her for the morning milking. Bessie needs her beauty sleep, so she wants to get b

2017-04-12 21:43:50 206

原创 POJ 1724 ROADS

DescriptionN cities named with numbers 1 ... N are connected with one-way roads. Each road has two parameters associated with it : the road length and the toll that needs to be paid for the road (

2017-03-21 20:23:58 232

原创 HDU 5907 Find Q

Problem DescriptionByteasar is addicted to the English letter 'q'. Now he comes across a string S consisting of lowercase English letters.He wants to find all the continous substrings of S,

2017-02-21 22:35:14 414

原创 HDU 6011 Lotus and Characters

Problem DescriptionLotus has n kinds of characters,each kind of characters has a value and a amount.She wants to construct a string using some of these characters.Define the value of a string is

2017-02-20 23:24:51 323

原创 矩阵连乘

问题描述:给定n个矩阵:A1,A2,...,An,其中Ai与Ai+1是可乘的,i=1,2...,n-1。确定计算矩阵连乘积的计算次序,使得依此次序计算矩阵连乘积需要的数乘次数最少。输入数据为矩阵个数和每个矩阵规模,输出结果为计算矩阵连乘积的计算次序和最少数乘次数。      问题解析:由于矩阵乘法满足结合律,故计算矩阵的连乘积可以有许多不同的计算次序。这种计算次序可以用加括号的方式来确定。若一

2017-01-04 14:48:55 424

原创 电路布线问题

作电路板时,将n条连线分布到若干绝缘层上。在同一层的连线不相交。电路布线问题就是要确定将哪些连线安排到第一层上,使该层上有尽可能多的连线。可以考虑最长连续递增子序列的方法求出结果#include#include#include#include#includeusing namespace std;#define M 101int n,a[M],dp[M];int ans;

2017-01-01 17:47:30 1209

原创 有重复元素的全排列问题

设有{r1,r2,...,rn}共n个元素,这n个元素中可能存在重复元素,试设计一个算法,列出这n个元素的不同排列。下面有三种实现方法,前两种是对应的字符串,最后一种后来写的关于数字的没啥好说的,调用STL库中的函数#include#include#include#include#include#include#includeusing namespace std;#d

2017-01-01 12:44:51 1317

原创 最多约数

最多约数问题。正整数 x 的约数是能整除x的正整数,其约数的个数记为div(x),例如div(10)=4。设 a 和 b 是两个正整数,找出 a 和 b 之间约数个数最多的数 x 的约数个数。样例输入: 1 36 样例输出: 9用到了质因数拆分,一个数的所有因数都可以用质数乘以它的指数来表示出来#include#include#inclu

2016-12-31 15:41:20 636

原创 dp总结(1)

******最小m段和问题代码:http://blog.csdn.net/zyq_19960204/article/details/53575851题意:给n个数,分成m段,取每段子序列的和的最大值,要求怎么分才能使这个最大值最小思路:用二维数组dp[n][m];(dp[i][j])i代表着当前扫到第几个元素,j代表了要分成几段因为大问题总是由小问题推出来的,d

2016-12-11 21:53:39 204

原创 最大k乘积

#include#include#include#include#includeusing namespace std;#define M 101int m[M][M],w[M][M],a[12];/*w[i][j]是i到j组成的数字m[i][j]表示的是前i个数字分成j段的最大乘积*/int I,n,k;void init(){ int i,j,temp=I;

2016-12-11 21:46:24 271

原创 最小m段和

#include#include#include#include#includeusing namespace std;#define M 101#define INF 1<<30int n,m;int a[M],f[M][M];/*来源:老师ppt思路:f[i][j]表示将前i个数分成j段,得到的最大最小值f[i][j]=min{max{f[i][1]-f[k][1],

2016-12-11 21:45:00 317

原创 独立任务最优调度问题

独立任务最优调度问题时间限制(普通/Java) : 1000 MS/ 3000 MS          运行内存限制 : 65536 KByte总提交 : 164            测试通过 : 35 比赛描述用2台处理机A和B处理n个作业。设第i个作业交给机器A处理时需要时间ai,若由机器B来处理,则需要时间bi。由于各作业的特点和机器的性能关系,很可能对于某些i,有

2016-12-11 17:21:29 1580

原创 最优合并问题

最优合并问题给定k个排好序的序列s1,s2,…,sk,用2路合并算法将这k个序列合并成一个序列。假设所采用的2路合并算法合并两个长度分别为m和n的序列需要m+n-1次比较。试设计一个算法确定合并这个序列的最优合并顺序,使所需要的总比较次数最少。测试用例: 4(序列数)5 12 11 2(序列中的元素数) 输出:     78(最差情况)     52(最优情

2016-12-07 09:35:14 2689

原创 poj 3259 Wormholes

DescriptionWhile exploring his many farms, Farmer John has discovered a number of amazing wormholes. A wormhole is very peculiar because it is a one-way path that delivers you to its destination a

2016-11-26 19:47:10 207

原创 扩展欧几里得算法理解

这段时间在刷一套关于扩展欧几里得算法的题目,现在做一下总结:对于不完全为 0 的非负整数 a,b,gcd(a,b)表示 a,b 的最大公约数,必然存在整数对 x,y ,使得 gcd(a,b)=ax+by。证明:设 a>b。  1,显然当 b=0,gcd(a,b)=a。此时 x=1,y=0;  2,ab!=0 时  设 ax1+by1=gc

2016-11-17 20:30:51 527

原创 HDU 2669 Romantic

Problem DescriptionThe Sky is Sprite.The Birds is Fly in the Sky.The Wind is Wonderful.Blew Throw the TreesTrees are Shaking, Leaves are Falling.Lovers Walk passing, and so are You. ..

2016-11-16 18:41:08 193

原创 POJ 1061 青蛙的约会

Description两只青蛙在网上相识了,它们聊得很开心,于是觉得很有必要见一面。它们很高兴地发现它们住在同一条纬度线上,于是它们约定各自朝西跳,直到碰面为止。可是它们出发之前忘记了一件很重要的事情,既没有问清楚对方的特征,也没有约定见面的具体位置。不过青蛙们都是很乐观的,它们觉得只要一直朝着某个方向跳下去,总能碰到对方的。但是除非这两只青蛙在同一时间跳到同一点上,不然是永远都不可能碰面

2016-11-16 08:58:30 177

原创 POJ 2115 C Looooops

DescriptionA Compiler Mystery: We are given a C-language style for loop of type for (variable = A; variable != B; variable += C) statement;I.e., a loop which starts by setting variable to

2016-11-16 08:52:01 203

概率论与数理统计

机器学习入门需要一些必备的知识,包括高数、线性代数、概率论

2018-09-09

鸟哥的私房菜

这本书是一本很好的Linux学习资源,现在的这本是基础篇,有兴趣的话可以在网上找一下设计比较深的一些内容

2015-12-08

空空如也

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

TA关注的人

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