自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

转载 悬浮窗管理

悬浮窗

2016-01-06 22:55:13 817

原创 获取状态栏高度的三种方法

状态栏高度

2016-01-06 22:33:44 3840

原创 Android常用控件(一)

WebView,TextSwithcer,Switcher

2016-01-06 22:27:28 494

原创 textview加链接

给textview加链接

2016-01-04 22:23:16 384

转载 MANACHER 最长回文序列

1、用一个数组记录字符串中每一个位置的回文半径 2、变量PR记录回文半径能扫到的最右位置的下一个索引值 3、变量index代表2中PR所对应的回文中心,二者在遍历过程中不断更新 图中left与right关于index对称,i'与i关于index对称,a、b和a'、b分别关于i 、i'对称 第一种情况,i’的回文半径落在index回文半径内部,i的回文半径就为i'的回文半径

2015-09-04 20:08:13 476

原创 JavaScript

JavaScript:基于对象和事件驱动的脚本语言 其特点:交互性,安全性,跨平台性 JavaScript与Java:前者基于对象,后者面向对象;前者只需解释即可执行后者需先编译再执行 JavaScript组成:ECMAScript,文档对象模型DOM,浏览器对象模型BOM ==========================================================

2015-08-19 17:16:55 355

原创 CSS

css与html结合方式: 1、属性方式 又为行内样式,适合局部修改 2、标签方式 又为内嵌样式,适合统一修改 3、导入方式 导入一个已存在的css文件@import url(*.css) 4、链接方式 head中的link标记实现,可以通过link标记链接多个css文件 ======================================================

2015-08-19 17:10:23 343

原创 HTML

file 本地文件传输协议 head是给Html页面增加辅助属性信息,内容最先加载 ============================================================================= XML是对数据信息的描述。HTML是数据显示的描述。 XML代码规定的更为严格 ===================================

2015-08-19 16:56:31 341

原创 PAT1077

#include #include #include using namespace std; char str1[300]; char str2[300]; vectorvc; int n; int main() { //freopen("in.txt","r",stdin); scanf("%d",&n); getchar(); gets(str1); gets(str2);

2015-03-19 23:02:07 410

原创 PAT1075(排序)

#include #include using namespace std; const int maxn=10010; struct node { int id; int total; int score[6]; int solve; int rank; int at; }stu[maxn]; int n,k,m; int full[6]; int cmp(node a,nod

2015-03-19 22:30:54 425

原创 PAT1074(静态链表)

#include #include using namespace std; const int maxn=100010; struct nod { int address; int data; int next; int at; }node[maxn]; int start,n,k; int cmp(nod a,nod b) { return a.at<b.at; } voi

2015-03-18 22:09:01 663

原创 PAT1073(字符串)

#include #include #include using namespace std; string str; int main() { //freopen("in.txt","r",stdin); cin>>str; if(str[0]=='-') printf("-"); str.erase(str.begin()); string::iterator it=str.

2015-03-18 21:16:40 523

转载 面试题3 有序数组合并

初阶:合并两个有序数组A和B,使得结果依然有序。 进阶:合并两个有序数组A和B,假设A有n个数,B有m个数,A数组后面还有m个空余空间,需要将结果保存在A中。 答: 一种解答当然是把两个数组放在一起重新排序了。这样的时间复杂度是O(nlogn),没有用到数组已经有序的条件,所以显然不是一个期望的解答。那么既然A和B已经有序,假设从小到大排序了,那么A和B中最小的数一定是A[0]和

2015-03-17 10:31:07 613

转载 面试题2 找坏球

有12个球,1个没有砝码的天秤。其中有11个球的重量是一样的,另外1个是坏球,和其他球的重量不一样,但无法确定是轻了还是重了。请问如何用天秤称3次,就找到坏球并确定是轻了还是重了。(没有砝码的天秤只能比较出两边谁重谁轻或是重量相等,无法求得具体的重量差) 将球进行编号: 1 2 3 4 5 6 7 8 9 10 11 12,分为三组:(1,2,3,4) (5,6,7,8) (9,

2015-03-17 10:23:16 452

转载 面试题1 落单的数

有2n+1个数,其中2n个数两两成对,1个数落单,找出这个数。要求O(n)的时间复杂度,O(1)的空间复杂度。 进阶问题:如果有2n+2个数,其中有2个数落单,该怎么办? 答: 初阶:将2n+1个数异或起来,相同的数会抵消,异或的答案就是要找的数。 进阶:假设两个不同的数是a和b,并且a!=b,将2n+2个数异或起来就会得到c=a xor b,并且c不等于0。因此在c的二进

2015-03-17 10:09:49 443

转载 PAT1071(字符串)

#include #include #include #include #include using namespace std; string str; vectorv; mapmp; int leg(char c) { if(c>='0'&&c='a'&&c='A'&&c<='Z') return 1; else return 0; } int main() { //fre

2015-03-16 21:23:03 430

原创 PAT1093

#include const int mode=1000000007; const int length=100010; char str[length]; int main() { //freopen("in.txt","r",stdin); scanf("%s",str); int count=0; int p=0; int pa=0; int pat=0; for(int

2015-03-16 18:52:21 461

转载 PAT1067

#include const int maxn=100010; int array[maxn]; int n; int count=0; int findk(int k)//从上次查找的地方开始 { for(int i=k;i<n;i++) if(array[i]!=i) return i; return 0; } int main() { //freopen("in.tx

2015-03-16 17:30:45 363

转载 PAT1066(AVL)

单旋转,只需改变K1,K2的指针域 双旋转,进行两次旋转。如图,先进行一次左单旋转,在进行一次右单旋转即可,改变的只是K1、K2、K3的指针域。 #include #include #include using namespace std; struct node { struct node* left; struct node* right; int value; in

2015-03-16 16:13:48 315

原创 PAT1086(二叉树)

#include #include using namespace std; int pre[31]; int in[31]; int n; char str[10]; int index1=0; int index2=0; int x; stacks; struct node { int data; node *left; node *right; }; node* creat(in

2015-03-10 15:07:08 479

原创 PAT1064

#include #include using namespace std; const int maxn=1010; int input[maxn]; int tree[maxn]; int n,index=1; void inorder(int root) { if(root>n) return ; inorder(root*2); tree[root]=input[index+

2015-03-09 14:27:42 622

原创 PAT1060

#include #include #include using namespace std; void deal1(string &s)//处里前导0 { while(s.size()>0&&*(s.begin())=='0') { s.erase(s.begin()); } } int deal2(string &s) { string::iterator it=s.begi

2015-03-09 10:58:26 458

原创 PAT1057

//树状数组 #include const int maxn=100010; int n; int s[maxn]; int num=0; char str[20]; int tree_array[maxn]; int lowbit(int x) { return x&(-x);//tree_array[x]所管辖的区域长度,以及到上一个父节点的距离 } void add(int pos

2015-03-08 20:51:05 464

原创 PAT1056

语文没学好。。。 #include #include #include using namespace std; const int maxm=1010; int np,ng; struct node { double weight; int layer; int rank; int id; }mice[maxm]; int cmp(node a,node b) { return

2015-03-08 13:09:05 460

原创 PAT1051

#include #include #include using namespace std; const int maxn=1010; int m,n,k; int main() { //freopen("in.txt","r",stdin); scanf("%d%d%d",&m,&n,&k); for(int i=0;i<k;i++) { stacks; queueq;

2015-03-07 20:02:34 458

原创 PAT1050

#include #include const int maxl=10010; char str1[maxl]; char str2[maxl]; int exist[maxl]={0};//hash表 int main() { //freopen("in.txt","r",stdin); gets(str1); gets(str2); int len=strlen(str2); f

2015-03-07 15:05:29 358

原创 PAT1049

#include int count(int x) { int sum=0; int base=1; while(x>=base) { int low=x%base;//低位数值 int high=x/(base*10);//高位数值 int digit=x%(base*10)/base;//正在处理位 if(digit==0) sum+=high*base;

2015-03-07 14:34:25 332

原创 PAT1048

#include #include using namespace std; const int maxn=100010; int n,m; int value[maxn]; int binarySearch(int l,int r,int x) { while(l<=r) { int mid=(r+l)/2; if(x==value[mid]) return mid;

2015-03-07 12:05:30 693

原创 pat1045

#include #include using namespace std; const int num1=210; const int num2=10010; int n,m,l; int x; int given[num2]; int dp[num2]; int cmp[num1]; int main() { //freopen("in.txt","r",stdin); scanf

2015-03-06 19:45:44 481

原创 PAT1044

#include #include #include using namespace std; const int num=100010; const int inf=1e9; int diamond[num]; int sum[num]={0}; int n,m; struct node { int pre; int post; }; vectorvc; int main() { /

2015-03-06 15:37:22 380

原创 PAT1040

#include #include #include using namespace std; int main() { string str; //freopen("in.txt","r",stdin); getline(cin,str); string::iterator it=str.begin(); int max=1; while(it!=str.end()) { f

2015-03-05 12:57:13 362

原创 PAT1039

#include #include #include using namespace std; const int num=10010; string str[num]; int judge(string &str) { string::iterator it=str.begin(); while(str.size()>0&&*(str.begin())=='0') str.erase

2015-03-05 11:16:37 314

原创 PAT1034

#include #include #include using namespace std; const int maxv=2010; const int inf=1e9; int g[maxv][maxv]; int weight[maxv]; int vis[maxv]; mapstr2int; mapint2str; mapres; int n,k; int numv=0; int

2015-03-04 17:40:45 566

原创 PAT1033

#include #include using namespace std; #define max 510 struct nod { double dst; double price; }node[max]; int cmp(nod a,nod b) { return a.dst<b.dst; } int main() { double c,d,perd; int n; //f

2015-03-04 11:13:23 606

转载 qsort与sort 排序

qsort采用快速排序的方法进行排序,存在于头文件中

2014-09-09 22:51:23 484

转载 map按value排序

依map的value进行排序时,不能直接使用sort函数,

2014-08-26 08:31:35 721

原创 九度1026

题目描述: 输入两个不超过整型定义的非负10进制整数A和B(31-1),输出A+B的m (1 输入: 输入格式:测试输入包含若干测试用例。每个测试用例占一行,给出m和A,B的值。 当m为0时输入结束。 输出: 输出格式:每个测试用例的输出占一行,输出A+B的m进制数。

2014-05-10 10:37:40 854

原创 九度1009

题目描述: 判断两序列是否为同一二叉搜索树序列 输入: 开始一个数n,(1 接下去一行是一个序列,序列长度小于10,包含(0~9)的数字,没有重复数字,根据这个序列可以构造出一颗二叉搜索树。 接下去的n行有n个序列,每个序列格式跟第一个序列一样,请判断这两个序列是否能组成同一颗二叉搜索树。 输出: 如果序列相同则输出YES,否则输出NO -------------

2014-05-09 11:30:15 910

原创 九度1078

题目描述: 二叉树的前序、中序、后序遍历的定义: 前序遍历:对任一子树,先访问跟,然后遍历其左子树,最后遍历其右子树; 中序遍历:对任一子树,先遍历其左子树,然后访问根,最后遍历其右子树; 后序遍历:对任一子树,先遍历其左子树,然后遍历其右子树,最后访问根。 给定一棵二叉树的前序遍历和中序遍历,求其后序遍历(提示:给定前序遍历与中序遍历能够唯一确定后序遍历)。 输入: 两个字

2014-05-08 23:18:37 788

原创 九度1101

题目描述: 对于一个不存在括号的表达式进行计算 输入: 存在多种数据,每组数据一行,表达式不存在空格 输出: 输出结果 样例输入: 6/2+3+3*4 样例输出: 18 ------------------------------------------------------------------------------------------

2014-05-07 21:29:38 950

空空如也

空空如也

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

TA关注的人

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