摘要: 银行有n个窗口,每个窗口可以排m个人,在n×m以外的顾客会选择最短的队列进行排队。给出每个顾客需要消耗的时间长度,求出每个顾客具体结束服务的时间 阅读全文
posted @ 2013-01-27 21:59 S.Zhang 阅读(592) 评论(0) 推荐(0) 编辑
摘要: 不值一讲的水题 阅读全文
posted @ 2013-01-25 14:52 S.Zhang 阅读(852) 评论(0) 推荐(0) 编辑
摘要: 给出学生3门课的成绩,求每名学生在3门课以及平均分中所能取得的最高排名。 阅读全文
posted @ 2013-01-23 14:43 S.Zhang 阅读(1746) 评论(1) 推荐(0) 编辑
摘要: 给定正整数n2^30,求出从0到n所有整数中1的个数 阅读全文
posted @ 2013-01-21 16:36 S.Zhang 阅读(1206) 评论(0) 推荐(0) 编辑
摘要: 打印多叉树每一级中叶节点的个数,其实就是检查从根节点到每个叶节点的长度,合并相同长度。深度优先遍历一把就好了,唯一要注意的是只有一个根节点的情况 阅读全文
posted @ 2013-01-18 13:37 S.Zhang 阅读(955) 评论(0) 推荐(0) 编辑
摘要: 1002题的改进版,加法变乘法 阅读全文
posted @ 2013-01-17 22:55 S.Zhang 阅读(231) 评论(0) 推荐(0) 编辑
摘要: The highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which floors the elevator will stop, in specified order. It costs 6 seconds to move the elevator up one floor, and 4 seconds to move down one floor. The elevator will stay for 5 seconds at each stop. 阅读全文
posted @ 2013-01-17 17:29 S.Zhang 阅读(194) 评论(0) 推荐(0) 编辑
摘要: Given a sequence of K integers { N1, N2, ..., NK }. A continuous subsequence is defined to be { Ni, Ni+1, ..., Nj } where 1 = i = j = K. The Maximum Subsequence is the continuous subsequence which has the largest sum of its elements. For example, given sequence { -2, 11, -4, 13, -5, -2 }, its maximum subsequence is { 11, -4, 13 } with the largest sum being 20. Now you are supposed to find the largest sum, together with the first and the last numbers of the maximum subsequence. 阅读全文
posted @ 2013-01-17 17:28 S.Zhang 阅读(1086) 评论(0) 推荐(0) 编辑
摘要: At the beginning of every day, the first person who signs in the computer room will unlock the door, and the last one who signs out will lock the door. Given the records of signing in's and out's, you are supposed to find the ones who have unlocked and locked the door on that day. 阅读全文
posted @ 2013-01-17 17:28 S.Zhang 阅读(437) 评论(0) 推荐(0) 编辑
摘要: Given a non-negative integer N, your task is to compute the sum of all the digits of N, and output every digit of the sum in English. 阅读全文
posted @ 2013-01-17 11:31 S.Zhang 阅读(567) 评论(0) 推荐(0) 编辑