该文被密码保护。 阅读全文
posted @ 2013-11-09 08:44 钟SX 阅读(0) 评论(0) 推荐(0) 编辑
摘要: 昨天上了大三的算法课,学了大整数乘法,上课听得很明白,但回来实现,就有点问题了。。① 做乘法的时候,要记得减去'0'的ascii码48。② 存数字的数组要记得从1开始存,如果从0开始存的话,进位时可能会导致越界 - -③ 进位时,记得要用一个循环,不断进位,这个地方坑了我很久 - - 1 #include 2 #include 3 #include 4 #define N 100 5 char number1[N]; 6 char number2[N]; 7 char result[2*N]; 8 9 int main()10 {11 printf( "please 阅读全文
posted @ 2013-09-14 08:49 钟SX 阅读(477) 评论(0) 推荐(0) 编辑
该文被密码保护。 阅读全文
posted @ 2013-09-03 17:55 钟SX 阅读(1) 评论(0) 推荐(0) 编辑
摘要: 这段时间做了很多很耗时的题目,想总结一下,学到了什么。。。首先第一道是风水吧,BFS的。我觉得,这道题,首先要想清楚,用怎么表示状态,方法有很多吧,但我能想到的,很暴力,八个方向,就开了一个八维的数组,嘻嘻,OJ老大,对不起啦哈哈哈~这道题可以用单向和双向的BFS,如果用单向的BFS和跟我一样想挑战OJ极限的孩子们,注意啦,数组开得要刚刚好,真的是算好那种开,你稍稍开大一丢丢,OJ就会报你超时 - - 我只能给你们点一支蜡烛了^.^....看我之前发过的代码,其实,是有个地方可以优化的,其实没有必要开标记数组,每一次初始化这个东西,真的忒耗时,你想啊,一个点只能更新一次,当它被更新的时候,他一 阅读全文
posted @ 2013-08-29 10:41 钟SX 阅读(311) 评论(0) 推荐(0) 编辑
摘要: SZUProblem(A16):Three JugsJudge InfoMemory Limit: 32768KBCase Time Limit: 10000MSTime Limit: 10000MSJudger: Number Only JudgerDescriptionFrogs start exploring the kingdom when the first frog land. Recently, explore teams find a locked door. There is no key to open the door, but there is a small alta 阅读全文
posted @ 2013-08-27 00:11 钟SX 阅读(265) 评论(0) 推荐(0) 编辑
摘要: SZUProblem(B40):Fengshui这道题超级坑,就是一个大大的坑,后台有三组数据,总题目的时间不能超过3秒,但是每组数组不能超过1秒,否则case time limited.因为我的方法很简单,就是套用BFS,八个方向为一个状态。。。不知道为什么,三组数据的总时间不超3秒,但她老人家第一数据就老超一秒,然后我就一直一直一直过不了。。后来优化到已经不能再优化了,我就突然发现,我的queue的数组好像开得有点点大,这样每轮初始化花的时间也会增加,我就只给了他几乎刚刚的量,然后就AC啦~~啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊阿啊啊啊啊啊啊 阅读全文
posted @ 2013-08-25 11:26 钟SX 阅读(227) 评论(4) 推荐(0) 编辑
摘要: SZUProblem(A70):Locked BoxesJudge InfoMemory Limit: 32768KBCase Time Limit: 10000MSTime Limit: 10000MSJudger: Number Only JudgerDescriptionPoseidon has N boxes with lock. What's inside the box? (hum..., think by yourself) Each box can either be opened with its corresponding key or smashed. Posei 阅读全文
posted @ 2013-08-23 08:40 钟SX 阅读(330) 评论(0) 推荐(0) 编辑
摘要: SZU Problem(A13):Frog MathematicJudge InfoMemory Limit: 32768KBCase Time Limit: 10000MSTime Limit: 10000MSJudger: Special Judge For Problem A13DescriptionFrog loves mathematics. Let’s have a look on a frog mathematics problem. First, there are some definitions here. A is an n×n matrix. Mi,j is 阅读全文
posted @ 2013-08-23 08:08 钟SX 阅读(664) 评论(0) 推荐(0) 编辑
摘要: SZU Problem(A58):City MapJudge InfoMemory Limit: 32768KBCase Time Limit: 10000MSTime Limit: 10000MSJudger: Number Only JudgerDescriptionYou are given a map representing the layout of a city. The city consists of blocks. The first row of map represents the first row of blocks, etc. A 'B' char 阅读全文
posted @ 2013-08-19 21:38 钟SX 阅读(455) 评论(2) 推荐(0) 编辑
摘要: 快速排序的归并排序: 1 void quickSort( int *array, int left, int right ) 2 { 3 int key = array[left]; // 取左边的第一个数为标准排序 4 int i = left; 5 int j = right; 6 while( i key ) 9 j--;10 array[i] = array[j];11 while( i= right )10 return;11 int mid = (left+right) ... 阅读全文
posted @ 2013-08-16 14:54 钟SX 阅读(392) 评论(2) 推荐(0) 编辑