EricYang

Tech Spot of Eric

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
上一页 1 2 3 4 5 6 7 ··· 18 下一页

2012年8月19日

摘要: Gone FishingTime Limit:2000MSMemory Limit:32768KTotal Submissions:24255Accepted:7082DescriptionJohn is going on a fishing trip. He has h hours available (1 <= h <= 16), and there are n lakes in the area (2 <= n <= 25) all reachable along a single, one-way road. John starts at lake 1, but 阅读全文
posted @ 2012-08-19 22:27 Eric-Yang 阅读(346) 评论(0) 推荐(0) 编辑

摘要: Max SequenceTime Limit:3000MSMemory Limit:65536KTotal Submissions:13533Accepted:5654DescriptionGive you N integers a1, a2 ... aN (|ai| <=1000, 1 <= i <= N).You should output S.InputThe input will consist of several test cases. For each test case, one integer N (2 <= N <= 100000) is gi 阅读全文
posted @ 2012-08-19 22:23 Eric-Yang 阅读(138) 评论(0) 推荐(0) 编辑

摘要: Maximum sumTime Limit:1000MSMemory Limit:65536KTotal Submissions:27486Accepted:8410DescriptionGiven a set of n integers: A={a1, a2,..., an}, we define a function d(A) as below:Your task is to calculate d(A).InputThe input consists of T(<=30) test cases. The number of test cases (T) is given in th 阅读全文
posted @ 2012-08-19 22:17 Eric-Yang 阅读(205) 评论(0) 推荐(0) 编辑

摘要: Subway tree systemsTime Limit:1000MSMemory Limit:10000KTotal Submissions:5735Accepted:2370DescriptionSome major cities have subway systems in the form of a tree, i.e. between any pair of stations, there is one and only one way of going by subway. Moreover, most of these cities have a unique central 阅读全文
posted @ 2012-08-19 22:16 Eric-Yang 阅读(226) 评论(0) 推荐(0) 编辑

摘要: Jury CompromiseTime Limit:1000MSMemory Limit:65536KTotal Submissions:21248Accepted:5424Special JudgeDescriptionIn Frobnia, a far-away country, the verdicts in court trials are determined by a jury consisting of members of the general public. Every time a trial is set to begin, a jury has to be selec 阅读全文
posted @ 2012-08-19 22:13 Eric-Yang 阅读(222) 评论(0) 推荐(0) 编辑

2012年8月17日

摘要: 参见编程珠玑chap4 chap9,和编程之美3.3给定一个有序(不降序)数组arr,,求任意一个i使得arr[i]等于t,不存在返回-1不变式:x[low]< =t<=x[high]int biSearch(int *arr, int low, int high, int t){ int mid; while(low<=high) { mid=low+(high-low)/2; if(arr[mid]==t) { return mid; } else if(arr[mid]>t) ... 阅读全文
posted @ 2012-08-17 16:16 Eric-Yang 阅读(198) 评论(0) 推荐(0) 编辑

2012年8月16日

摘要: 1 //µÝ¹éºÍ·ÇµÝ¹é±éÀúTree 2 // 1 3 // / \ 4 // 2 3 5 // / \ / \ 6 // 4 5 6 7 7 //Pre-Order: 1 2 4 5 3 6 7 8 //In-Order: 4 2 5 1 6 3 7 9 //Post-Order:4 5 2 6 7 3 1 10 11 #include <iostream> 12 #include <cstdio> 阅读全文
posted @ 2012-08-16 22:12 Eric-Yang 阅读(217) 评论(0) 推荐(0) 编辑

摘要: zzhttp://blog.csdn.net/dlengong/article/details/7408019输入括号的数目,输出括号的各种合法匹配样式 如输入 2输出( ())()()据说这是一道某公司的面试题,我们先来分析一下。括号匹配有合法有的不合法 如 (()))( 这样就不是合法的匹配样式。为了避免这种情况的出现,记录当前左括号的个数和右括号的个数,使右括号的个数不大于左括号的个数。主要思想类似于0-1背包问题,当进行到某一步的时候 有两种方法:放'(' 和 放 ')' 1 #include <iostream> 2 #include &l 阅读全文
posted @ 2012-08-16 21:51 Eric-Yang 阅读(251) 评论(0) 推荐(0) 编辑

2012年8月15日

摘要: 字符串比较函数,这个函数也比较常用:view plaincopy to clipboardprint?int strcmp(const char* str1,const char* str2){ assert(str1!=NULL&&str2!=NULL); while(*str1&&*str2&&*str1==*str2){ str1++; str2++; } if(*str1==*str2&&*str1==0) return 0;//equal else if(*str1... 阅读全文
posted @ 2012-08-15 23:17 Eric-Yang 阅读(754) 评论(0) 推荐(0) 编辑

摘要: Brackets SequenceTime Limit:1000MSMemory Limit:65536KTotal Submissions:19727Accepted:5465Special JudgeDescriptionLet us define a regular brackets sequence in the following way:1. Empty sequence is a regular sequence.2. If S is a regular sequence, then (S) and [S] are both regular sequences.3. If A a 阅读全文
posted @ 2012-08-15 16:04 Eric-Yang 阅读(175) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 7 ··· 18 下一页