2013年1月17日

我的blog搬家啦

摘要: 基于各种原因的考虑,近期将搬到csdn~ 阅读全文

posted @ 2013-01-17 11:38 yumao 阅读(122) 评论(0) 推荐(0) 编辑

2013年1月6日

再读dijkstra算法 以及运用

摘要: 在《图论算法及程序设计》中,这个算法没有明显的提出,叫:最短路的标号法。再一次发现,我对dijkstra的理解还是不够啊~其关键在于贪心。。每一次选出的特定点到其他点的最短路都是每一次的最优解,也就是说,求出来之后,最短路就不会再改变了,要这样想:既然每一次都是得到的最优值,那么会使下一次得到的也是最优值。。。不知道说清楚没有。。。编程的代码思路就是:找到已经得到的最优解的点,由这些点得到还没有最优解的点,如果两者之间有边,且best<v[i,j]+d[i]那么把best的值更新;每次把n个点遍历完后,将best的值赋给最小的那个点,如果best的值与其初值相同,没有改变,说明该图中的特 阅读全文

posted @ 2013-01-06 21:45 yumao 阅读(219) 评论(0) 推荐(0) 编辑

2012年12月30日

usaco 1.4 Arithmetic Progressions

摘要: Arithmetic ProgressionsAn arithmetic progression is a sequence of the form a, a+b, a+2b, ..., a+nb where n=0,1,2,3,... . For this problem, a is a non-negative integer and b is a positive integer.Write a program that finds all arithmetic progressions of length n in the set S of bisquares. The set of 阅读全文

posted @ 2012-12-30 18:15 yumao 阅读(537) 评论(0) 推荐(0) 编辑

2012年12月16日

讲课@USC 杂谈

摘要: 星期五晚上我在112讲了一节有关DP的课。。。讲了完整的一节才知道,原来要讲一节课这么难啊。。。上课之前要准备材料,要想好讲什么,怎么讲,要备好ppt(而且还要做的生动形象)唉,真是不上课不知道老师的难处啊。。。而且真的觉得之前学长们还有袁、段、杨给我们上了那么多节课,不容易啊。。感动~~不过我觉得这也是一种精神,我会把它传递下去的。。。回原题啦其实,在讲课的时候还是会脑子里一片空白的。。。不过多了应该就习惯啦~不得不说,真是长江后浪推前浪啊~学弟们的想法太有爱了。。。这堂课下来,让我对很多东西有了新的理解:)很值啊!恩恩,以后要再接再厉,继续加油啊O(∩_∩)O 阅读全文

posted @ 2012-12-16 23:04 yumao 阅读(172) 评论(1) 推荐(0) 编辑

2012年12月15日

training@USC permutation

摘要: PermutationTime Limit:1000ms Memery Limit:32768KAccepted/Submit(Users): 1/1(100.0%)DescriptionHappy PMP is freshman and he is learning about algorithmic problems. He enjoys playing algorithmic games a lot. One of the seniors gave Happy PMP a nice game. He is given two permutations of numbers 1 thro. 阅读全文

posted @ 2012-12-15 23:06 yumao 阅读(205) 评论(0) 推荐(0) 编辑

2012年12月10日

usaco 1.3 Packing Rectangle

摘要: Packing Rectangles IOI 95 The six basic layouts of four rectanglesFour rectangles are given. Find the smallest enclosing (new) rectangle into which these four may be fitted without overlapping. By smallest rectangle, we mean the one with the smallest area.All four rectangles should have their sides 阅读全文

posted @ 2012-12-10 11:59 yumao 阅读(359) 评论(0) 推荐(0) 编辑

2012年12月7日

usaco 1.3 Prime Cryptarithm

摘要: Prime CryptarithmThe following cryptarithm is a multiplication problem that can be solved by substituting digits from a specified set of N digits into the positions marked with *. If the set of prime digits {2,3,5,7} is selected, the cryptarithm is called a PRIME CRYPTARITHM. * * * x * * ... 阅读全文

posted @ 2012-12-07 23:03 yumao 阅读(164) 评论(0) 推荐(0) 编辑

2012年12月2日

training@USC 12 2

摘要: CJ的任务Time Limit:1000ms Memery Limit:32768KAccepted/Submit(Users): 2/5(40.0%)Description CJ无所事事一段时间后,突然接到了Boss的任务。这次Boss一次性给他安排了n个任务(1<=n<100000),要求在m天内完成(m<1000000)。CJ这下得忙坏了,接到任务的第1天他就开始工作了!CJ知道每个任务的最迟开始时间为第d天,价值为v(d,v为整数,d<1000000, v<100),每个任务都可以都需要1天才能完成。现在CJ困惑了,怎样才能使价值最大,他找到了学计算机的你 阅读全文

posted @ 2012-12-02 15:57 yumao 阅读(165) 评论(0) 推荐(0) 编辑

2012年12月1日

Freopen()与ofstream()

摘要: freopen:freopen(const char *filename,const char *type, FILE *stream);也就是说将stream流于文件名为filename的关联起来。。。进行类型为第二个参数type的操作。。。(一般是‘w’或者'r')这样,就可以在程序中直接进行原来的输入输出,而程序会自动的将输入输出与指定的内容绑定起来~ofstream ifstreamofstream name("path");定义一个文件流名,以及其引号中的路径以及文件名;即与文件流的输入输出相绑定的文件;之后,就可以直接用name来<< 阅读全文

posted @ 2012-12-01 19:46 yumao 阅读(508) 评论(0) 推荐(0) 编辑

usaco pro 52 Calf Flac

摘要: Calf FlacIt is said that if you give an infinite number of cows an infinite number of heavy-duty laptops (with very large keys), that they will ultimately produce all the world's great palindromes. Your job will be to detect these bovine beauties.Ignore punctuation, whitespace, numbers, and case 阅读全文

posted @ 2012-12-01 18:24 yumao 阅读(300) 评论(0) 推荐(0) 编辑

导航