自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 高楼扔鸡蛋

将题目抽象一下,就是如何获取某个元素在有序数组中的位置。这样就很容易的想到用二分法去解决。但考虑到扔鸡蛋这个问题是寻找元素位置的异化,鸡蛋的数量是有限。在某种情况下鸡蛋的数量会小于logN所以不能全使用二分法进行解决。所以可以考虑使用动态规范来进行解决问题:动态规划一般需要考虑两个问题1 是找到能代表问题的状态在这个题目中很明显当前拥有的鸡蛋数 K 和需要测试的楼层数 N 就是问题所代表的状态2 是找到问题之间的递推公式而每在第i层扔一个鸡蛋,状态都会发生相应的转移容易根据dp公式得出递归

2022-04-13 21:14:15 122

原创 MySQL中的复合主键是否会性能缺陷

INSERT和UPDATE性能几乎没有变化:这将是(INT)和(INT, INT)键几乎相同。SELECT复合材料PRIMARY KEY的性能取决于许多因素。如果您的表格是InnoDB,那么该表格将隐式聚合在PRIMARY KEY值上。这意味着如果两个值都包含关键字,那么对两个值的搜索将会更快:不需要额外的密钥查找。假设你的查询是这样的:SELECT * FROM mytable WHERE col1 = @value1 AND col2 = @value2 与表格的布局是这样

2020-10-29 10:10:01 1517

原创 java后台生成word格式的pdf文档思路,包echarts图片,及 EChartsConvert使用注意问题

将word模板保存为xml格式。将模板中的关键词与图片使用占位符替换,保存为freemarker 模板。后端将图表数据传送PhantomJS中,使用 EChartsConvert生成echarts图片。注意问题bug1:饼图绘制不了,request时就卡住的问题solution1:此处并不是饼图绘制不了,而是只要opt中含有’%‘都会挂,原因是作者在代码里执行了两次decodeURIComponent(详情参考echarts-convert.js源码259行),所以’%‘传递时也必需encod.

2020-10-14 10:03:21 761

原创 smali/baksmali Expected a command 报错

smali/baksmali Expected a command 过来看一下因为2.2版本作者把语法改了,所有按照旧的来就会报错 https://github.com/JesusFreke/smali/wiki/SmaliBaksmali2.2 baksmali disassemble app.apk -o app smali assemble app -o classes.dex...

2018-02-08 10:33:05 1744 2

原创 bison: m4: Invalid argument 玄学解决了

https://sourceforge.net/p/gnuwin32/bugs/173/一开始百度了一上午发现找不到,后来google一下。发现有人提出了这个问题,但是还是解决不了。 后来突发奇想,把m4.exe拷贝到当前工作目录就好了。我也不知道为什么…….

2017-08-25 14:06:43 2770 7

转载 poj 1061 青蛙的约会

#include<cstdio> #include<iostream>#include<algorithm>using namespace std;typedef long long LL;LL e_gcd(LL a,LL b,LL &x,LL &y){ if(b==0) { x=1; y=0; return a; }

2017-04-10 19:31:02 152

转载 New Year Snowmen CodeForces - 140C

“`includeincludeincludeincludeincludeincludeusing namespace std; map

2017-03-09 09:50:36 190

原创 Fire Game FZU - 2150

#include<iostream>#include<queue>#include<vector>#include<cstring>using namespace std;char maze[11][11];int book[11][11];struct point { int x,y; int time;};vector<point>vec;queue<poin

2017-03-09 08:59:18 176

原创 Andryusha and Colored Balloons

dfs记录一下父节点就好了#include<iostream> #include<cstdio>#include<cstring>#include<vector>using namespace std;int arr[200004];vector<int>u[200004];int m=0;void dfs(int node ,int father){ int now=1;

2017-03-07 22:33:13 205

原创 B. Sherlock and his girlfriend

#include<cstdio> #include<cstring>#include<iostream>#include<string>using namespace std;int arr[100100];int main(){ for(int i=2;i<100100;i++) if(!arr[i]) for(int j=2;i*j<100100;j++)

2017-03-07 16:02:59 233

转载 Corn Fields POJ - 3254

#include<cstdio> #include<cstring>#include<iostream>#define mod 100000000 using namespace std;int M,N,top=0;int state[600],num[110];int dp[20][600];int cur[20];inline bool ok(int x){ if(

2017-03-07 14:26:11 168

转载 Godfather POJ - 3107

#include <iostream>#include <cstdio>#include <algorithm>#include <vector>#include <cstring>using namespace std;const int INF = 0x3f3f3f3f;const int MAXN = 50010;int tot[MAXN],f[MAXN], minx,size

2017-03-07 12:08:13 185

转载 B The Meeting Place Cannot Be Changed

#include<iostream>#include<cstdio>#include<vector>using namespace std; int num;struct node{ int x; int v;};double min (double x, double y) { return x < y ? x : y;}double max (do

2017-03-07 11:16:05 179

原创 Tree Cutting POJ - 2378

#include<iostream>#include<cstdio>#include<cstring>#include<vector>#include<algorithm>using namespace std;int dp[10005][2],num;vector<int>p[10005]; vector<int>vec;void dfs(int node,int fa){

2017-03-06 21:12:09 211

原创 Strategic game POJ - 1463

#include<iostream>#include<cstdio>#include<cstring>using namespace std;int vis[1510],father[1510],dp[1510][2],num;void dfs(int node){ vis[node]=1; dp[node][1]=1; for(int i=0;i<num;i+

2017-03-06 19:34:46 187

原创 Anniversary party POJ - 2342

#include<iostream>#include<cstdio>#include<cstring>using namespace std;int vis[6003],father[6003],dp[6003][2],num;void dfs(int par){ vis[par]=1; for(int i=1;i<=num;i++) if(!vis[i]&&f

2017-03-06 18:53:25 171

原创 Arithmetic Progression CodeForces - 382C

Everybody knows what an arithmetic progression is. Let us remind you just in case that an arithmetic progression is such sequence of numbers a1, a2, …, an of length n, that the following condition fulf

2017-03-06 08:43:18 300

原创 Sail CodeForces - 298B

The polar bears are going fishing. They plan to sail from (sx, sy) to (ex, ey). However, the boat can only sail by wind. At each second, the wind blows in one of these directions: east, south, west or

2017-03-06 08:42:12 259

原创 Snow Footprints

There is a straight snowy road, divided into n blocks. The blocks are numbered from 1 to n from left to right. If one moves from the i-th block to the (i + 1)-th block, he will leave a right footprint

2017-03-06 08:41:07 251

原创 1127. ZigZagging on a Tree (30)

很简单的题,先根据中序排序,与后序排序递归建树,然后层次遍历存入到out数组中,用now存储当前遍历的先后次序,用level来存储当前层数,date存储数据。用sort结构体排序,不同层次按从小到到排。相同层次,如果是奇数层,按now大到小排,如果为偶数层,按now的大小到大排。#include<iostream> #include<cstdio>#include<vector>#includ

2017-03-04 19:17:47 380

原创 1108. Finding Average (20)

2的测试点过不了是这个问题 The average of 1 number is Y#include<iostream> #include<cstdio>#include<cstring>#include<cstdlib>using namespace std;double sum=0;int judge(char arr[]){ int len=strlen(arr

2017-02-27 17:40:45 142

原创 剪邮票

如【图1.jpg】, 有12张连在一起的12生肖的邮票。 现在你要从中剪下5张来,要求必须是连着的。 (仅仅连接一个角不算相连) 比如,【图2.jpg】,【图3.jpg】中,粉红色所示部分就是合格的剪取。请你计算,一共有多少种不同的剪取方法。#include<iostream> #include<cstdio>using namespace std;int arr[4][3],ju[50

2017-02-26 09:02:47 199

原创 1110. Complete Binary Tree (25)

Given a tree, you are supposed to tell if it is a complete binary tree.Input Specification:Each input file contains one test case. For each case, the first line gives a positive integer N (<=20) which

2017-02-20 19:11:50 167

原创 1112. Stucked Keyboard (20)

On a broken keyboard, some of the keys are always stucked. So when you type some sentences, the characters corresponding to those keys will appear repeatedly on screen for k times.Now given a resulting

2017-02-19 19:10:10 130

原创 1114. Family Property

This time, you are supposed to help us collect the data for family-owned property. Given each person’s family members, and the estate(房产)info under his/her own name, we need to know the size of each fa

2017-02-19 15:16:32 221

原创 1122. Hamiltonian Cycle (25)

The “Hamilton cycle problem” is to find a simple cycle that contains every vertex in a graph. Such a cycle is called a “Hamiltonian cycle”.In this problem, you are supposed to tell if a given cycle is

2017-02-14 14:10:14 118

原创 1064. 朋友数(20)

如果两个整数各位数字的和是一样的,则被称为是“朋友数”,而那个公共的和就是它们的“朋友证号”。例如123和51就是朋友数,因为1+2+3 = 5+1 = 6,而6就是它们的朋友证号。给定一些整数,要求你统计一下它们中有多少个不同的朋友证号。注意:我们默认一个整数自己是自己的朋友。输入格式:输入第一行给出正整数N。随后一行给出N个正整数,数字间以空格分隔。题目保证所有数字小于104。输出格式:首先第一

2017-02-14 11:37:22 185

原创 1065. 单身狗(25)

“单身狗”是中文对于单身人士的一种爱称。本题请你从上万人的大型派对中找出落单的客人,以便给予特殊关爱。输入格式:输入第一行给出一个正整数N(<=50000),是已知夫妻/伴侣的对数;随后N行,每行给出一对夫妻/伴侣——为方便起见,每人对应一个ID号,为5位数字(从00000到99999),ID间以空格分隔;之后给出一个正整数M(<=10000),为参加派对的总人数;随后一行给出这M位客人的ID,以空

2017-02-14 11:25:44 152

原创 nim博弈

定义   作者:SimonS通常的Nim游戏的定义是这样的: 有若干堆石子,每堆石子的数量都是有限的,合法的移动是“选择一堆石子并拿走若干颗(不能不拿)”,如果轮到某个人时所有的石子堆都已经被拿空了,则判负(因为他此刻没有任何合法的移动)。这个游戏很久以前就已经有了,可是必胜策略直至20世纪初才被哈佛大学的一个叫做Charles Leonard Bouton的数学家找到,可见其思维难

2016-12-01 13:07:58 169

原创 A. Grasshopper And the String

A. Grasshopper And the String ![这里写图片描述](http://img.blog.csdn.net/20161114224713092)time limit per test1 second memory limit per test256 megabytes inputstandard input outputstand

2016-11-14 22:47:58 248

原创 线段树

线段树生成查找线段树    是由n个节点所构成的二分查找树,每次都已logn的时间来查询,可以查找树表示的线的某一段大小。生成     线段树的生成非常好操作,首先需要读入每一个点,储存到数组中,用一个下标cur来记录当前生成元素在数组中的位置。再记录生成子线段的范围,如果是点,则储存,否则,递归的生成左右子线段,后,把左右子线段相加当父线段中。规定把中点当作左线段的边界。查找

2016-11-11 14:30:57 114

空空如也

空空如也

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

TA关注的人

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