自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

volatile

  今天才了解volatile的功能, 以前只知道它修饰变量的, 让变量每次操作时都要从内存中读取, 而不使用寄存器来临时存储. 今天才知道还有这么一个超级好的功能!  能够修饰无返回值的函数, 如: void have(void); void volatile abc(void) { //do something have(); } int main(void...

2010-07-03 10:57:30 106

算法确实是灵魂

  学真的过瘾啊, 书写得好, 一个例子一个例子的讲解, 废话也不多,, 在这里批评一下严蔚敏同志,, 书写的确实没外国的教材好~!  这本书的例子都很简单, 但简单里面各个都透着大道理,, 现在看链表, 提到了程序的移植,, 以前一直以为程序的移植不是什么大事,, 但是在看来, 应该叫做算法的移植, 程序真的只是工具, 算法才是灵魂, 一个程序快, 不能够说是写这个程序的语言有多么多么的...

2010-04-14 18:13:54 166

插入排序

  狂抓,,, 这么简单的一个算法,, 写了我好久好久``!!!  日啊~!~!~![code="C"]void insertsort(int *a, int len){ int i, j, t; for(i = 1; i < len; i++){ if(a[i] < a[i - 1]){ t = a[i]; for(j = i - 1; j >= 0...

2010-03-31 21:40:24 102

重做 USACO 1.1 黑色星期五

[code="C"]/*LANG: CID: zqynux11PROG: beads*/#include #include char ball[701];int main(void){ int max = 0; int a = 0, b = 0, w = 0; /* */ int i, n; char ch = '\0'; fre...

2010-03-31 18:59:37 133

重做 USACO 1.1 黑色星期五

  解释什么的就算了吧,, [code="C"]/*LANG: CID: zqynux11PROG: friday*/#include #include int days[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};int week[7];int main(void){ int...

2010-03-31 18:59:05 97

重做 USACO 1.1 贪婪的送礼者

  这题的话, 我用的是个结构体, 记录各个人.. 我错了的地方我注释了`[code="C"]/*LANG: CID: zqynux11PROG: gift1*/#include #include struct people{ char name[15]; int given, got;}pep[10];int np;int find(c...

2010-03-31 18:58:09 130

重做 USACO 1.1 你的飞碟在这儿

  不解释了..[code="C"]/*LANG: CID: zqynux11PROG: ride*/#include #define loop(i, j)\p = i;\while(*p != '\0'){\ j *= *p - 'A' + 1;\ p++;\}/* 之前将p++掉了.. */int main(void){ ch...

2010-03-31 18:56:33 125

USACO 3.1 Shaping Regions 形成的区域

  这题二话不说, 用map[i][j]表示坐标为i, j的点是什么颜色的.. 很快就写出来了, 但是内存超过了,, 内存最多16MB.  没办法, 只好另辟思路, 但是在数据压缩方面我又很弱, 就看标程也花了两三天的时间, 今天终于是看懂了..  用rect记录所有矩形的坐标以及相应的颜色.  程序具体的步骤如下:  输入A, B, N. 记录第一个矩形: (0, 0) (A...

2010-03-30 20:01:04 334

插值查找(插值搜索)

  这是一种和二分比较相似的查找的算法, 不过不同的是, 对于分布比较均匀的较大的数组, 插值查找有时能够一次就搜索到位..  为什么能够这么快呢`? 看网上没有什么关于这种算法的描述, 我就来描述一下吧.  首先要知道一点, 这种搜索方式只能够针对顺序表进行,, 再一个要理解顺序表中的一个特点, 在顺序表中查找是否存在一个值, 此时我可以对顺序表中的任意一个元素进行比较, 如果我要在A中...

2010-03-29 12:29:38 309

折半搜索

  折半搜索的思想很简单, 就是假设有一个集合S={a1, a2, a3, a4...an}, 其中满足(a[i-1] < a[i]).. 折半的就先和中间的比较, 如果比中间值的大, 如果t在集合里面的话, 那么就一定只会在后半段了, 不会在前半段.. 以此类推吧``[code="C"]int search(int *a, int size, int t){ int low, hig...

2010-03-28 22:01:37 129

USACO 3.1 Humble Numbers 丑数

  从这一题开始,, 以后题目我就不贴上来了... 自己去看吧..  这一题开始肯本看不懂,, 后来是反反复复看标程看懂了..  首先要理解这么一个式子吧(算是式子吧``)  已经求出了j-1个丑数,, 现在求第j个丑数  对于每一个素数p乘以一个最小的丑数, 能使积大于第j-1个丑数    在这些乘积中寻找最小的一个即位第j个丑数.  用pindex[i]表示对于第i...

2010-03-28 15:31:49 110

USACO 3.1 Score Inflation 总分

Score InflationThe more points students score in our contests, the happier we here at the USACO are. We try to design our contests so that people can score as many points as possible, and would li...

2010-03-27 20:19:07 145

USA 3.1 Agri-Net 最短网络

Agri-NetRuss Cox Farmer John has been elected mayor of his town! One of his campaign promises was to bring internet connectivity to all farms in the area. He needs your help, of course. Farmer...

2010-03-27 20:14:52 100

USACO 2.4 Fractions to Decimals 分数化小数

Fractions to DecimalsWrite a program that will accept a fraction of the form N/D, where N is the numerator and D is the denominator and print the decimal representation. If the decimal representat...

2010-03-27 15:47:53 152

USACO 2.4 Bessie Come Home 回家

Bessie Come HomeKolstad & Burch It's dinner time, and the cows are out in their separate pastures. Farmer John rings the bell so they will start walking to the barn. Your job is to figure out whic...

2010-03-27 13:01:48 182

USACO 2.4 Cow Tours 牛的旅行

Cow ToursFarmer John has a number of pastures on his farm. Cow paths connect some pastures with certain other pastures, forming a field. But, at the present time, you can find at least two pasture...

2010-03-27 11:57:32 104

USACO 2.4 Overfencing 穿越栅栏

USACO 2.4 Overfencing 穿越栅栏OverfencingKolstad and Schrijvers Farmer John went crazy and created a huge maze of fences out in a field. Happily, he left out two fence segments on the edges, and thu...

2010-03-25 18:18:11 321

USACO 2.4 The Tamworth Two 两只塔姆沃斯牛

The Tamworth TwoBIO '98 - Richard Forster A pair of cows is loose somewhere in the forest. Farmer John is lending his expertise to their capture. Your task is to model their behavior. The chas...

2010-03-23 22:05:43 217

USACO 2.3 Controlling Companies 控制公司

Controlling CompaniesSome companies are partial owners of other companies because they have acquired part of their total shares of stock. For example, Ford owns 12% of Mazda. It is said that a com...

2010-03-23 22:00:02 206

USACO 1.1 Broken Necklace 破碎的项链

Broken NecklaceYou have a necklace of N red, white, or blue beads (3

2010-03-22 18:04:10 307

USACO 2.3 Money Systems 货币系统

Money SystemsThe cows have not only created their own government but they have chosen to create their own money system. In their own rebellious way, they are curious about values of coinage. Tradi...

2010-03-22 13:31:46 169

USACO 2.3 Cow Pedigrees 奶牛家谱

Farmer John is considering purchasing a new herd of cows. In this new herd, each mother cow gives birth to two children. The relationships among the cows can easily be represented by one or more binar...

2010-03-21 15:02:05 182

USACO 2.3 Zero Sum 零的算式和

Zero SumConsider the sequence of digits from 1 through N (where N=9) in increasing order: 1 2 3 ... N. Now insert either a `+' for addition or a `-' for subtraction or a ` ' [blank] to run the...

2010-03-20 14:30:08 173

USACO Longest Prefix最长前缀

Longest PrefixIOI'96 The structure of some biological objects is represented by the sequence of their constituents denoted by uppercase letters. Biologists are interested in decomposing a long seq...

2010-03-17 12:28:18 101

vijos 谁拿了最多奖学金

描述 Description   某校的惯例是在每学期的期末考试之后发放奖学金。发放的奖学金共有五种,获取的条件各自不同:   1) 院士奖学金,每人8000元,期末平均成绩高于80分(>80),并且在本学期内发表1篇或1篇以上论文的学生均可获得;   2) 五四奖学金,每人4000元,期末平均成绩高于85分(>85),并且班级评议成绩高于80分(>80)的学生均...

2010-03-17 12:25:48 96

USACO 2.2 Subset Sums集合

USACO 2.2 Subset Sums集合  For many sets of consecutive integers from 1 through N (1

2010-03-16 12:18:49 167

Packing Rectangles 铺放矩形块 (IOI 95)

Packing Rectangles 铺放矩形块 (IOI 95)在网上看了挺多解释这一题的文章,总感觉没看大懂,所以自己写一篇文章吧。希望能够帮助大家理解一下这一题。题目如下:http://www.nocow.cn/index.php/Translate:USACO/packrec 开始拿到题目确实没怎么看懂,网上也有很多人说它是个水题,我倒感觉不以为然,我看了一...

2010-03-16 12:16:18 337

素数统计.

  这几天围着素数统计这一题就把我搞蒙了.. 题目是这样的: 输入一个整数n, 输出小于等于n的素数个数..  刚开始, 觉得题目挺容易的,, 马上写了一个程序出来, 测试了一下, 结果没错.. 急急忙忙的就提交了,, 后来再把题目仔细看了看,, n的范围是1~二百万.. 时间要求时1s. 我自信的敲入了两百万.. 结果十分钟才把结果蹦出来... 我这么没用啊,,, 时间要求1s,, ...

2010-03-16 12:12:37 111

电脑中数字的表示方式`

  哎呀, 首先为自己的空间开张庆祝一下吧`` 还挺开心的, zqynux 这名字儿没人用, 以后我就用这名字了, 一个呢是代表我的名字, zqy, 后面nux就和 Linus 的Linux 一样的, 属于自恋的类型吧.. 如果以后我就机会写操作系统的话, 一定要叫zqynux... 好了废话不多说了, 创建这个博客就是想写一些学习时的经验和发一下以前的问题..  以前学C, 反码补码就是...

2010-03-16 12:09:02 352

空空如也

空空如也

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

TA关注的人

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