自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 多线程编程

多线程的几种方式PThreadNSThreadCGD (Grand Center Dispatch)NSOperation (NSInvaocationOperation / NSBlockOperation)1.PThreadPOSIX Thread(Portable Operation System Interface) 可移植的操作系统的接⼝口 ⼀一套通⽤用的多线程API;基于C语⾔言的接⼝口

2016-02-25 17:06:29 351

原创 SQLite

使用SQLite之前 需要添加libsqlite3.0.tbd#import "ViewController.h"#import <sqlite3.h>@interface ViewController ()@end@implementation ViewController- (void)viewDidLoad { [super viewDidLoad]; //1.创建一个空的数

2016-02-25 16:18:47 289

转载 CoreData

简介Core Data是iOS5之后才出现的一个框架,它提供了对象-关系映射(ORM)的功能,即能够将OC对象转化成数据,保存在SQLite数据库文件中,也能够将保存在数据库中的数据还原成OC对象。在此数据操作期间,我们不需要编写任何SQL语句,这个有点类似于著名的Hibernate持久化框架,不过功能肯定是没有Hibernate强大的。简单地用下图描述下它的作用: 左边是关系模型,即数据库,

2016-02-25 16:07:37 262

原创 FMDB

FMDB的使用介绍iOS中原生的SQLite API在使用上相当不友好,在使用时,非常不便。于是,就出现了一系列将SQLite API进行封装的库,FMDB (https://github.com/ccgus/fmdb) 是一款简洁、易用的封装库,这一篇文章简单介绍下FMDB的使用。在FMDB下载文件后,工程中必须导入如下文件,并使用 libsqlite3.dylib 依赖包。MRC和ARC在FM

2016-02-25 14:59:52 406

原创 2013蓝桥杯C/C++本科B组预赛题目解答

1.题目标题: 高斯日记    大数学家高斯有个好习惯:无论如何都要记日记。    他的日记有个与众不同的地方,他从不注明年月日,而是用一个整数代替,比如:4210    后来人们知道,那个整数就是日期,它表示那一天是高斯出生后的第几天。这或许也是个好习惯,它时时刻刻提醒着主人:日子又过去一天,还有多少时光可以用于浪费呢?    高斯出生于:1777年4月30日。    在高斯

2014-02-15 22:02:33 1116

原创 poj 1664

放苹果Time Limit: 1000MS Memory Limit: 10000KTotal Submissions: 24066 Accepted: 15303Description把M个同样的苹果放在N个同样的盘子里,允许有的盘子空着不放,问共有多少种不同的分法?(用K表示)5,1,1和1,5,1 是同一种分法。In

2013-10-04 14:27:23 454

原创 poj 1013

Counterfeit DollarTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 36646 Accepted: 11717DescriptionSally Jones has a dozen Voyageur silver dollars. How

2013-10-01 20:26:03 417

转载 最大连续子序列的和

问题描述:输入一组整数,求出这组数字子序列和中最大值。也就是只要求出最大子序列的和,不必求出最大的那个序列。例如:序列:-2 11 -4 13 -5 -2,则最大子序列和为20。序列:-6 2 4 -7 5 3 2 -1 6 -9 10 -2,则最大子序列和为16。算法一://穷举法,复杂度O(n^3)  最容易想到也是最简单的算法[cpp]long maxSubSum

2013-09-09 19:59:11 416

原创 hdoj 1003

Max SumTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 115460    Accepted Submission(s): 26774Problem DescriptionGiven a sequence a[

2013-09-09 19:45:32 514

原创 鸟哥的私房菜之指令输入与基本指令

好了,既然我们是以文字界面介绍Linux,那么自然需要先谈谈指令的输入。一般情况下,指令的输入格式为:[root@test root]# command [-options] parameter1 parameter2 ... 指令  选项  参数(1)  参数(2) 说明:1. 指令与参数区分字母大小写;2. command为指令的名称,例如变换路径的指令为cd,等等;

2013-08-31 09:21:05 681

转载 ubuntu 常用命令

精选的十二个ubuntu下的命令,熟记于心,则能甩掉ubuntu小白标签,高手的伟岸形象焕然生发。一、管理员权限绝大部分情况下,命令的行为须要被赋予管理员权限才能执行。命令 sudo 作用:赋予当前命令行为管理员权限。样式:sudo 其它命令举例:sudo su #切换到超级管理员权限模式#二、文件操作命令2.1 cd作用:改变终端当前目录位置样式:cd 目

2013-08-30 18:52:51 851

原创 鸟哥的私房菜之第一篇

Linux到底是什么在说linux之前,不能不提Kernel(内核)这个名词。简单的说,内核就是控制硬件的东西。这里我们先来谈一谈整体的操作系统架构,好让大家比较容易了解。在使用计算机的时候,显示影像的硬件是显卡和屏幕,连接Internet的硬件组件是网卡,发出声音的硬件是声卡!这么说来,所有实际操作的东西都是“硬件”的工作。但是硬件怎么知道如何工作呢?这就是“核心”的工作了!核心就是

2013-08-30 10:20:51 617

转载 prim算法简介及实现

prim算法是基于顶点来实现最小生成树的,我们假设使用邻接矩阵来存储图的,在prim算法实现的过程中,我们需要知道以下两类信息1.集合T1内各顶点到集合T2中个顶点的权值最小边的权值     //其中T2集合是表示这些集合中的点已经是最小生成树中的点了2.集合T1内个顶点距离集合T2中哪个顶点的距离最小为此,我们用两个数组来实现上面两类信息lowcost[maxn]

2013-08-23 19:23:30 513

转载 数据结构之查找二叉树

数据结构之查找二叉树前不久去腾讯笔试,居然几道数据结构方面的题目,让我情何以堪啊,都做不动,忘完了,趁着这里想找实习的地方,肯定还要笔试,所以复习一下。注意:函数指针传递的用法1.二叉树重要性质:性质1:在二叉树的第i层上至多有2^(i-1)个节点(i >= 1)性质2:深度为k的二叉树至多有2^(k-1)个节点(k >=1)性质3:对于任意

2013-08-23 19:20:55 726

转载 数据结构之哈夫曼树

数据结构之哈夫曼树1.哈夫曼树简介(1) WPL = 7*2+5*2+2*2+4*2 = 36; (1) WPL = 7*1+5*2+2*3+4*3 = 35;经过证明此为最小的WPL即为哈夫曼树在解决某些问题时,利用哈夫曼树可以找到最佳判定算法,因为某些条件出现的频率不一样,这样导致了同一段代码在不同的环境下取得的效

2013-08-23 19:19:54 897

转载 数据结构之AVL树

数据结构之AVL树1 .基本概念AVL树的复杂程度真是比二叉搜索树高了整整一个数量级——它的原理并不难弄懂,但要把它用代码实现出来还真的有点费脑筋。下面我们来看看:1.1  AVL树是什么?AVL树本质上还是一棵二叉搜索树(因此读者可以看到我后面的代码是继承自二叉搜索树的),它的特点是:1. 本身首先是一棵二叉搜索树。 2. 带有平衡条件:每个结点的左右子树

2013-08-23 19:18:52 532

转载 排序之qsort函数

排序之qsort函数qsort函数是C语言库提供的快速排序的库函数,位于头文件在一般应用的时候我们应该尽量选择使用库函数,因为库函数一般都是经过优化总结出来的C代码,这样也可以少写大篇幅的代码。1.qsort函数之int型排序注意C语言里没有布尔类型,一般为0值为假,非零值为真。int array[100];int cmp ( const  void

2013-08-23 19:17:36 512

转载 图之基础

图之基础我们这里不再啰嗦图的基本概念了,关于图的基本概念在很多数据结构的树上都有,我们先讨论图的存储,毕竟是先有了存储了图才能对图做处理呢,当然有些高手也可以忽略图的存储来做,呵呵,图的存储一般有两种方式,即邻接矩阵和邻接表,邻接矩阵实际上就是一个二维数组,使用邻接矩阵很方便且很容易懂,但是在图为稀疏图的时候就有点浪费存储空间了,你想一下嘛,如果有3000个顶点,那么我们就要开辟3

2013-08-23 19:16:03 464

转载 图之遍历

图之遍历图的遍历一般由两者方式:深度优先搜索(DFS),广度优先搜索(BFS),深度优先就是先访问完最深层次的数据元素,而BFS其实就是层次遍历,每一层每一层的遍历。1.深度优先搜索(DFS)我一贯习惯有举例的方法来讲,示例如下:红色代表的是正搜索,蓝色代表回溯,最下面为标志数组。注意:DFS的搜索出来的序列不是每个人都是一样的,根据具体的程序可能出现不同的

2013-08-23 19:14:14 510

转载 最小生成树之kruskal算法

最小生成树之kruskal算法1.kruskal算法假设连通网N=(V,{E})。则令最小生成树的初始状态为只有n个顶点而无边的非连通图T=(V,{}),图中每个顶点自成一个连通分量。在E中选择最小代价的边,若该边依附的顶点落在T中不同的连通分量中,则将该边加入到T中,否则舍去此边而选择下一条代价最小的边,依次类推,直到T中所有顶点都在同一连通分量上为止。示例如下:

2013-08-23 18:58:55 475

转载 最小生成树之prim算法

最小生成树之prim算法边赋以权值的图称为网或带权图,带权图的生成树也是带权的,生成树T各边的权值总和称为该树的权。   最小生成树(MST):权值最小的生成树。   生成树和最小生成树的应用:要连通n个城市需要n-1条边线路。可以把边上的权值解释为线路的造价。则最小生成树表示使其造价最小的生成树。   构造网的最小生成树必须解决下面两个问题:    1、尽

2013-08-23 18:57:32 765

原创 uva 10106

Product The ProblemThe problem is to multiply two integers X, Y. (0250)The InputThe input will consist of a set of pairs of lines. Each line in pair contains one multiplyer.The Output

2013-08-17 10:55:30 675

原创 uva 424

Integer Inquiry One of the first users of BIT's new supercomputer was Chip Diller. He extended his exploration of powers of 3 to go from 0 to 333 and he explored taking various sums of those n

2013-08-17 10:54:17 654

原创 uva 537

Artificial Intelligence? Physics teachers in high school often think that problems given as text are more demanding than pure computations. After all, the pupils have to read and understand th

2013-08-17 10:51:41 716

原创 uva 10115

Problem E: Automatic EditingSource file:autoedit.{c, cpp, java, pas}Input file:autoedit.inOutput file:autoedit.outText-processing tools like awk and sed allow you

2013-08-17 10:50:51 641

原创 uva 10815

Andy's First DictionaryAndy, 8, has a dream - he wants to produce his very own dictionary. This is not an easy task for him, as the number of words that he knows is, well, not quite enough. Instea

2013-08-16 11:47:13 528

原创 uva 644

Immediate Decodability An encoding of a set of symbols is said to be immediately decodable if no code for one symbol is the prefix of a code for another symbol. We will assume for this problem

2013-08-16 11:45:28 686

原创 uva 10878

Problem ADecode the tapeTime Limit: 1 second"Machines take me by surprise with great frequency."Alan TuringYour boss has just unearthed a roll of old computer tapes. The

2013-08-16 11:42:58 567

原创 uva 10361

Problem IAutomatic PoetryInput: standard inputOutput: standard outputTime Limit: 2 secondsMemory Limit: 32 MB “Oh God”, Lara Croft exclaims, “it’s one of these dumb rid

2013-08-16 11:40:50 452

原创 uva 10010

Where's Waldorf? Given a m by n grid of letters, ( ), and a list of words, find the location in the grid at which the word can be found. A word matches a straight, uninterrupted line of le

2013-08-16 11:37:48 615

原创 uva 401

Palindromes A regular palindrome is a string of numbers or letters that is the same forward as backward. For example, the string "ABCDEDCBA" is a palindrome because it is the same when the str

2013-08-16 11:29:11 471

原创 uva 457

Linear Cellular Automata A biologist is experimenting with DNA modification of bacterial colonies being grown in a linear array of culture dishes. By changing the DNA, he is able ``program" th

2013-08-16 11:26:27 665

原创 uva 694

The Collatz Sequence An algorithm given by Lothar Collatz produces sequences of integers, and is described as follows:Step 1:Choose an arbitrary positive integer A as the first item in the s

2013-08-16 11:24:10 501

原创 uva 489

Hangman Judge In ``Hangman Judge,'' you are to write a program that judges a series of Hangman games. For each game, the answer to the puzzle is given as well as the guesses. Rules are the sam

2013-08-16 11:22:12 535

原创 uva 445

Marvelous Mazes Your mission, if you decide to accept it, is to create a maze drawing program. A maze will consist of the alphabetic characters A-Z, * (asterisk), and spaces.Input and Output

2013-08-16 11:19:24 473

原创 uva 490

Rotating Sentences In ``Rotating Sentences,'' you are asked to rotate a series of input sentences 90 degrees clockwise. So instead of displaying the input sentences from left to right and top

2013-08-16 11:18:04 534

原创 uva 414

Machined Surfaces An imaging device furnishes digital images of two machined surfaces that eventually will be assembled in contact with each other. The roughness of this final contact is to be

2013-08-16 11:16:19 7939

原创 uva 494

Kindergarten Counting Game Everybody sit down in a circle. Ok. Listen to me carefully.``Woooooo, you scwewy wabbit!''Now, could someone tell me how many words I just said?Input and Outpu

2013-08-16 11:14:20 494

原创 uva 488

Triangle Wave In this problem you are to generate a triangular wave form according to a specified pair of Amplitude and Frequency.Input and OutputThe input begins with a single positive in

2013-08-16 11:11:09 1012

原创 uva 458

The Decoder Write a complete program that will correctly decode a set of characters into a valid message. Your program should read a given file of a simple coded set of characters and print th

2013-08-16 11:08:10 611

空空如也

空空如也

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

TA关注的人

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