Fork me on GitHub

随笔分类 -  算法练习

摘要:题目: 给你n个数字v(1),v(2),...,v(n-1),v(n),每次你可以取出最左端的数字或者取出最右端的数字,一共取n次取完。假设你第i次取的数字是x,你可以获得i*x的价值。你需要规划取数顺序,使获得的总价值之和最大。Input第一行一个数字n(1<=n<=2000)。下面n行每行一个数 阅读全文
posted @ 2020-06-26 17:02 shiyu-coder 阅读(127) 评论(0) 推荐(0)
摘要:题目: FatMouse believes that the fatter a mouse is, the faster it runs. To disprove this, you want to take the data on a collection of mice and put as l 阅读全文
posted @ 2020-06-25 15:21 shiyu-coder 阅读(145) 评论(0) 推荐(0)
摘要:题目: 某国为了防御敌国的导弹袭击,发展出一种导弹拦截系统.但是这种导弹拦截系统有一个缺陷:虽然它的第一发炮弹能够到达任意的高度,但是以后每一发炮弹都不能超过前一发的高度.某天,雷达捕捉到敌国的导弹来袭.由于该系统还在试用阶段,所以只有一套系统,因此有可能不能拦截所有的导弹.怎么办呢?多搞几套系统呗 阅读全文
posted @ 2020-06-24 19:11 shiyu-coder 阅读(129) 评论(0) 推荐(0)
摘要:题目: Jesus, what a great movie! Thousands of people are rushing to the cinema. However, this is really a tuff time for Joe who sells the film tickets. 阅读全文
posted @ 2020-06-24 18:35 shiyu-coder 阅读(113) 评论(0) 推荐(0)
摘要:题目: 都说天上不会掉馅饼,但有一天gameboy正走在回家的小径上,忽然天上掉下大把大把的馅饼。说来gameboy的人品实在是太好了,这馅饼别处都不掉,就掉落在他身旁的10米范围内。馅饼如果掉在了地上当然就不能吃了,所以gameboy马上卸下身上的背包去接。但由于小径两侧都不能站人,所以他只能在小 阅读全文
posted @ 2020-06-23 12:19 shiyu-coder 阅读(103) 评论(0) 推荐(0)
摘要:题目: Pass a year learning in Hangzhou, yifenfei arrival hometown Ningbo at finally. Leave Ningbo one year, yifenfei have many people to meet. Especiall 阅读全文
posted @ 2020-06-19 09:13 shiyu-coder 阅读(162) 评论(0) 推荐(0)
摘要:题目: 大家一定觉的运动以后喝可乐是一件很惬意的事情,但是seeyou却不这么认为。因为每次当seeyou买了可乐以后,阿牛就要求和seeyou一起分享这一瓶可乐,而且一定要喝的和seeyou一样多。但seeyou的手中只有两个杯子,它们的容量分别是N 毫升和M 毫升 可乐的体积为S (S<101) 阅读全文
posted @ 2020-06-18 19:01 shiyu-coder 阅读(206) 评论(0) 推荐(0)
摘要:题目: The GeoSurvComp geologic survey company is responsible for detecting underground oil deposits. GeoSurvComp works with one large rectangular region 阅读全文
posted @ 2020-06-18 15:01 shiyu-coder 阅读(89) 评论(0) 推荐(0)
摘要:题目: 定义一个二维数组: int maze[5][5] = { 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, }; 它表示一个迷宫,其中的1表示墙壁,0表示可以走的路,只能横着走或竖着走,不能斜 阅读全文
posted @ 2020-06-18 12:19 shiyu-coder 阅读(181) 评论(0) 推荐(0)
摘要:题目: Joe works in a maze. Unfortunately, portions of the maze have caught on fire, and the owner of the maze neglected to create a fire escape plan. He 阅读全文
posted @ 2020-06-18 11:54 shiyu-coder 阅读(95) 评论(0) 推荐(0)
摘要:题目: Fat brother and Maze are playing a kind of special (hentai) game on an N*M board (N rows, M columns). At the beginning, each grid of this board is 阅读全文
posted @ 2020-06-18 08:52 shiyu-coder 阅读(226) 评论(0) 推荐(0)
摘要:题目: Given two sequences of numbers : a[1], a[2], ...... , a[N], and b[1], b[2], ...... , b[M] (1 <= M <= 10000, 1 <= N <= 1000000). Your task is to fi 阅读全文
posted @ 2020-06-17 21:21 shiyu-coder 阅读(98) 评论(0) 推荐(0)
摘要:题目: You are given two pots, having the volume of A and B liters respectively. The following operations can be performed: FILL(i) fill the pot i (1 ≤ i 阅读全文
posted @ 2020-06-16 21:39 shiyu-coder 阅读(108) 评论(0) 推荐(0)
摘要:题目: A common pastime for poker players at a poker table is to shuffle stacks of chips. Shuffling chips is performed by starting with two stacks of pok 阅读全文
posted @ 2020-06-16 16:41 shiyu-coder 阅读(80) 评论(0) 推荐(0)
摘要:题目: Given a positive integer n, write a program to find out a nonzero multiple m of n whose decimal representation contains only the digits 0 and 1. Y 阅读全文
posted @ 2020-06-16 11:37 shiyu-coder 阅读(141) 评论(0) 推荐(0)
摘要:题目: Farmer John knows that an intellectually satisfied cow is a happy cow who will give more milk. He has arranged a brainy activity for cows in which 阅读全文
posted @ 2020-06-15 18:23 shiyu-coder 阅读(130) 评论(0) 推荐(0)
摘要:题目: Farmer John has been informed of the location of a fugitive cow and wants to catch her immediately. He starts at a point N (0 ≤ N ≤ 100,000) on a 阅读全文
posted @ 2020-06-15 08:02 shiyu-coder 阅读(156) 评论(0) 推荐(0)
摘要:You are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed of unit cubes which may or may not be filled with rock. 阅读全文
posted @ 2020-06-14 23:56 shiyu-coder 阅读(140) 评论(0) 推荐(0)