STL队列、优先队列、栈
摘要:STL中优先队列的使用方法(priority_queu)基本操作:empty() 如果队列为空返回真pop() 删除对顶元素push() 加入一个元素size() 返回优先队列中拥有的元素个数top() 返回优先队列对顶元素在默认的优先队列中,优先级高的先出队。在默认的int型中先出队的为较大的数。...
阅读全文
posted @
2014-07-31 09:29
lipching
阅读(170)
推荐(0)
回想大一
摘要:这一篇回忆录早就想写了,但是却迟迟没有写下……今天看到学长博客的闲聊文章,突然想起,便写下这段文字。 大一,从一个遥远的地方到长春,真的让人很后悔,这里的生活我很不适应,一直都有吐槽的地方,这里就不详细说了,说说自己的大一便好。 大一,我是一个比较喜欢交际的人,在学习上总是专心不了,歪门邪道倒是有...
阅读全文
posted @
2014-07-30 17:09
lipching
阅读(285)
推荐(1)
第5章 基础题目选解
摘要:学习目标: 学会用常量表简化代码 学会用状态变量辅助字符串读入 学会用结构体定义高精度证书,并设计构造函数、复制构造函数和输入输出方法 学会为结构体定义“小于”运算符,并用它定义其他比较运算符 熟悉掌握冒泡排序和排序检索 熟练掌握用qsort库函数给整数和字符串排序的方法 熟练掌握小规模素数表的构造...
阅读全文
posted @
2014-07-30 16:13
lipching
阅读(224)
推荐(0)
排序算法汇总
摘要:总结各种算法之前,现介绍下几个概念:1、稳定度:稳定排序算法会依照相等的关键(换言之就是值)维持纪录的相对次序。也就是一个排序算法是稳定的,就是当有两个有相等关键的纪录R和S,且在原本的串行中R出现在S之前,在排序过的串行中R也将会是在S之前。2、计算的复杂度(最差、平均、和最好表现),依据串行(l...
阅读全文
posted @
2014-07-29 16:52
lipching
阅读(207)
推荐(0)
sprintf函数
摘要:sprintf() 格式化输出函数(图形)头文件:stdio.h功能: 函数sprintf()用来作格式化的输出。用法: 此函数调用方式为int sprintf(char *string,char *format,arg_list);说明: 函数sprintf()的用法和printf()函数一样,只...
阅读全文
posted @
2014-07-29 10:34
lipching
阅读(6479)
推荐(1)
sscanf函数和正则表达式
摘要:此文所有的实验都是基于下面的程序:char str[10];for (int i = 0; i using namespace std;int main(){ char str[10]; for (int i = 0; i #include #include static void ss...
阅读全文
posted @
2014-07-29 10:05
lipching
阅读(310)
推荐(0)
第4章 函数和递归
摘要:学习目标: 掌握多参数、单返回值的数学函数的定义和使用方法 学会用typedef定义结构体 学会用assert宏帮助调试 理解函数调用时用实参给形参赋值的过程 学会定义局部变量和全局变量 理解调用栈和栈帧,学会用gdb查看调用栈并选择栈帧 理解地址和指针 理解递归定义和递归函数 理解可执行文件中的正...
阅读全文
posted @
2014-07-28 09:57
lipching
阅读(167)
推荐(0)
I Hate It
摘要:Time Limit:3000MSMemory Limit:32768KB64bit IO Format:%I64d & %I64uSubmitStatusDescription很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。这让很多学生很反感。不管你喜不喜欢,现在...
阅读全文
posted @
2014-07-26 16:24
lipching
阅读(134)
推荐(0)
Frogger
摘要:Time Limit:1000MSMemory Limit:65536KB64bit IO Format:%I64d & %I64uSubmitStatusDescriptionFreddy Frog is sitting on a stone in the middle of a lake. Su...
阅读全文
posted @
2014-07-26 11:14
lipching
阅读(167)
推荐(0)
- Oil Deposits 深搜,就是所谓的dfs
摘要:Time Limit:1000MSMemory Limit:32768KB64bit IO Format:%I64d & %I64uSubmitStatusDescriptionThe GeoSurvComp geologic survey company is responsible for de...
阅读全文
posted @
2014-07-25 16:20
lipching
阅读(169)
推荐(0)
Aggressive cows
摘要:Time Limit:1000MSMemory Limit:65536KB64bit IO Format:%I64d & %I64uSubmitStatusDescriptionFarmer John has built a new long barn, with N (2 #include #...
阅读全文
posted @
2014-07-25 16:17
lipching
阅读(216)
推荐(0)
Phone List
摘要:Time Limit:1000MSMemory Limit:65536KB64bit IO Format:%I64d & %I64uSubmitStatusDescriptionGiven a list of phone numbers, determine if it is consistent ...
阅读全文
posted @
2014-07-25 15:36
lipching
阅读(186)
推荐(0)
Word Amalgamation
摘要:Time Limit:1000MSMemory Limit:10000KB64bit IO Format:%I64d & %I64uSubmitStatusDescriptionIn millions of newspapers across the United States there is a...
阅读全文
posted @
2014-07-25 09:35
lipching
阅读(162)
推荐(0)
Street Numbers
摘要:Time Limit:1000MSMemory Limit:10000KB64bit IO Format:%I64d & %I64uSubmitStatusPracticePOJ 3624DescriptionA computer programmer lives in a street with ...
阅读全文
posted @
2014-07-24 15:27
lipching
阅读(228)
推荐(0)
Charm Bracelet——背包问题
摘要:Time Limit:1000MSMemory Limit:65536KB64bit IO Format:%I64d & %I64uSubmitStatusPracticePOJ 3624DescriptionBessie has gone to the mall's jewelry store a...
阅读全文
posted @
2014-07-24 10:49
lipching
阅读(225)
推荐(0)
函数参考
摘要:1.字符测试:isalnum(测试字符是否为英文或数字) 相关函数 isalpha,isdigit,islower,isupper表头文件 #include定义函数 int isalnum (int c)函数说明 检查参数c是否为英文字母或阿拉伯数字,在标准c中相当于使用“isalpha(c) ||...
阅读全文
posted @
2014-07-24 10:33
lipching
阅读(481)
推荐(0)
assert()函数用法总结——转
摘要:assert宏的原型定义在中,其作用是如果它的条件返回错误,则终止程序执行,原型定义:#include void assert( int expression ); assert的作用是现计算表达式 expression ,如果其值为假(即为0),那么它先向stderr打印一条出错信息,然后通过调...
阅读全文
posted @
2014-07-22 17:00
lipching
阅读(185)
推荐(0)
c/c++中数学函数
摘要:1.abs 原型:extern int abs(int x); 用法:#include 功能:求整数x的绝对值 说明:计算|x|, 当x不为负时返回x,否则返回-x 举例: // abs.c #include #include ...
阅读全文
posted @
2014-07-22 15:27
lipching
阅读(315)
推荐(0)
算法竞赛入门经典——第3章答案
摘要:习题3-1 分数统计(stat)输入一些学生的分数,哪个分数出现的次数最多?如果有多个并列,从小到大输出。任务1:分数均不超过100的非负整数任务2:分数均不超过100的非负实数,但最多保留两位小数。这个类似单词统计词频,按字典序输出频率最高的那些。【思路】pic任务1和任务2差不多,换成doubl...
阅读全文
posted @
2014-07-22 14:23
lipching
阅读(588)
推荐(0)
第三章学习小结—-转
摘要:【学习目标】01掌握一维数组的声明和使用方法(OK)02掌握二维数组的声明和使用方法(OK)03掌握字符串的声明、赋值、比较和连接方法(连接很少用)04熟悉字符的ASCII码和ctype.h中的字符函数05正确认识++、+=等能修改变量的运算符(OK)06学会用编译选项-Wall获得更多的警告信息(...
阅读全文
posted @
2014-07-21 08:46
lipching
阅读(208)
推荐(0)
isalpha函数和isdigit函数
摘要:函数:isalpha 原型:int isalpha(int ch) 用法:头文件加入#include (旧版本的编译器使用) 功能:判断字符ch是否为英文字母,当ch为英文字母a-z或A-Z时,在标准c中相当于使用“isupper(ch)||islower(ch)”做测试,返回非零值,否则返...
阅读全文
posted @
2014-07-19 16:06
lipching
阅读(827)
推荐(0)
重新实现库函数
摘要:练习1:只用getchar函数读入一个整数。假设它占据单独的一行,读到行末为止,包括换行符。输入保证读入的整数可以保存在int中。代码://改进方案 3.4.4-1 只用getchar函数读入一个整数。#include int main(){ int c; int n=0; w...
阅读全文
posted @
2014-07-19 15:59
lipching
阅读(252)
推荐(0)
树状数组总结——转
摘要:转自:夏天的风http://blog.csdn.net/shahdza/article/details/6314818#comments又做了几道树状数组的题,决定放一块儿总结一下;恩,总结一下。。(ps:大牛可以直接跳过。。。)这得从一张图说起;树状数组中用的d【】,每个点都有一定的管辖范围;如d...
阅读全文
posted @
2014-07-19 10:04
lipching
阅读(246)
推荐(0)
线段树——转
摘要:一:线段树基本概念1:概述线段树,类似区间树,是一个完全二叉树,它在各个节点保存一条线段(数组中的一段子数组),主要用于高效解决连续区间的动态查询问题,由于二叉结构的特性,它基本能保持每个操作的复杂度为O(lgN)!性质:父亲的区间是[a,b],(c=(a+b)/2)左儿子的区间是[a,c],右儿子...
阅读全文
posted @
2014-07-19 10:01
lipching
阅读(154)
推荐(0)
博弈论 Sprague-Grundy函数 ——转
摘要:Nim游戏是组合游戏(Combinatorial Games)的一种,准确来说,属于“Impartial Combinatorial Games”(以下简称ICG)。满足以下条件的游戏是ICG(可能不太严谨):1、有两名选手;2、两名选手交替对游戏进行移动(move),每次一步,选手可以在(一般而言...
阅读全文
posted @
2014-07-19 09:57
lipching
阅读(373)
推荐(0)
博弈论类题目小结——转载
摘要:出处http://blog.csdn.net/ACM_cxlove?viewmode=contents by---cxlove首先当然要献上一些非常好的学习资料:基础博弈的小结:http://blog.csdn.net/acm_cxlove/article/details/7854530经典翻硬币游...
阅读全文
posted @
2014-07-19 09:55
lipching
阅读(548)
推荐(0)
Box Game
摘要:There are two identical boxes. One of them contains n balls, while the other box contains one ball. Alice and Bob invented a game with the boxes and b...
阅读全文
posted @
2014-07-19 09:52
lipching
阅读(286)
推荐(0)
One-Two-Three
摘要:Your little brother has just learnt to write one, two and three, in English. He has written a lot of those words in a paper, your task is to recognize...
阅读全文
posted @
2014-07-19 09:49
lipching
阅读(298)
推荐(0)
Counting Game
摘要:There arenpeople standing in a line, playing a famous game called ``counting". When the game begins, the leftmost person says ``1" loudly, then the se...
阅读全文
posted @
2014-07-19 09:37
lipching
阅读(448)
推荐(0)
3-3 蛇形填数
摘要:在n*n方阵里填入1,2,...,n*n,要求填成蛇形,例如n=4时方阵为:10 11 12 19 16 13 28 15 14 37 6 5 4上面的方阵中,多余的空格只是为了便于观察规律,不必严格输出。n≤8。分析: 定义一个二维数组存储方阵,先是下,到不能填为止,然后是左,接着是...
阅读全文
posted @
2014-07-18 09:24
lipching
阅读(216)
推荐(0)
3-1开灯问题
摘要:有n盏灯,编号1~n。第1个人把所有灯打开,第2个人按下所有编号为2的倍数的开关(这些灯将被关掉),第3个人按下所有编号为3的倍数的开关(其中关掉的灯将被打开,开着的灯将被关闭),依次类推。一共有k个人,问最后由哪些灯开着? 输入n和k,1≤k≤n≤1000。输出开着的灯编号。样例输入7 3样例输出...
阅读全文
posted @
2014-07-17 15:52
lipching
阅读(143)
推荐(0)
排序
摘要:用1,2,3……9组成3个三位数abc,def和ghi,每个数字恰好使用一次,要求abc:def:ghi = 1:2:3。输出所有解。提示:不必太动脑筋。分析:利用数组,a[1]~a[9]赋值为0,令a[出现的数字] = 1,若a[1] + a[2] + …… +a[9] == 9,则全部数字都出现...
阅读全文
posted @
2014-07-17 14:48
lipching
阅读(125)
推荐(0)
分数化小数
摘要:题目:输入正整数a,b,c,输出a/b的小数形式,精确到小数点后c位。a,b #include#includeint main(){ int a,b,c,x,y,mod,m,r,i; while(~scanf("%d %d %d",&a,&b,&c)) { print...
阅读全文
posted @
2014-07-17 14:29
lipching
阅读(192)
推荐(0)
子序列的和
摘要:输入两个正整数nint main(){ int n,m,i; double sum; while(~scanf("%d %d",&n,&m)) { sum=0; for(i=n;i<=m;i++) { sum+=...
阅读全文
posted @
2014-07-17 13:48
lipching
阅读(218)
推荐(1)
统计(stat)
摘要:题目:输入一个正整数n,然后读取n个正整数a1, a2, a3...,an,最后再读取一个正整数m。统计数列中多少个正整数的值小于m。代码:#include #include void main(){ int i,n,m,number=0; int *p; scanf("%d", ...
阅读全文
posted @
2014-07-17 13:41
lipching
阅读(315)
推荐(0)
The Famous Clock
摘要:The Famous Clock Time Limit:1000MSMemory Limit:0KB64bit IO Format:%lld & %lluMr. B, Mr. G and Mr. M are now in Warsaw, Poland, for the 2012’s ACM-ICP...
阅读全文
posted @
2014-07-17 11:23
lipching
阅读(326)
推荐(0)
A Famous City
摘要:A Famous City Time Limit:7000MSMemory Limit:0KB64bit IO Format:%lld & %lluAfter Mr. B arrived in Warsaw, he was shocked by the skyscrapers and took se...
阅读全文
posted @
2014-07-17 11:21
lipching
阅读(550)
推荐(0)
A Famous ICPC Team
摘要:A Famous ICPC Team Time Limit:1000MSMemory Limit:0KB64bit IO Format:%lld & %lluMr. B, Mr. G, Mr. M and their coach Professor S are planning their way...
阅读全文
posted @
2014-07-17 11:18
lipching
阅读(333)
推荐(0)
A Famous Music Composer
摘要:A Famous Music Composer Time Limit:1000MSMemory Limit:0KB64bit IO Format:%lld & %lluMr.B is a famous music composer. One of his most famous work was ...
阅读全文
posted @
2014-07-17 11:13
lipching
阅读(311)
推荐(0)
近似运算
摘要:计算兀/4=1-1/3+1/5-1/7+……,直至最后一项小于10的-6次方。错误做法:#include#includeint main(){ int i; double t,m; m=3.14159/4.0; for(i=1;;i++) { if(i%2...
阅读全文
posted @
2014-07-16 10:18
lipching
阅读(171)
推荐(0)
倒三角形
摘要:输入正整数n≤20,输入一个n层的倒三角形。例如n=5时输入如下:************************ *#includeint main(){ int n,i,j,a,b,c,m; a=0; b=1; while(~scanf("%d",&n)) { ...
阅读全文
posted @
2014-07-15 16:13
lipching
阅读(364)
推荐(0)
韩信点兵
摘要:相传韩信才智过人,从不直接清点自己军队的人数,只是让士兵先后以三人一排,五人一排,七人一排的变换队形,而他每一次只掠一眼队伍的排尾就知道军队的总人数了。输入3个非负整数a,b,c,表示每种队形排尾的人数(aint main(){ int i,a,b,c; while(~scanf("%d %d %d...
阅读全文
posted @
2014-07-15 15:30
lipching
阅读(180)
推荐(0)