- 博客(45)
- 资源 (3)
- 收藏
- 关注
原创 随笔_1
人生没有标准,人生就像水,你知道源头在那,却不知道到底从哪来,比如黄河来至于青海省青藏高原的巴颜喀拉山脉查哈西拉山的扎曲,准确来说是那个地下面,可是地下水,为什么会来到这里呢?****************************************************************************************************也许,有人说
2017-07-10 12:09:30 405
原创 D - 最长公共子序列Lcs
给出两个字符串A B,求A与B的最长公共子序列(子序列不要求是连续的)。比如两个串为: abcicbaabdkscab ab是两个串的子序列,abc也是,abca也是,其中abca是这两个字符串最长的子序列。Input第1行:字符串A 第2行:字符串B (A,B的长度 <= 1000)Output输出最长的子序列,如果有多个,随意输出1个。Sa...
2017-07-31 14:28:56 296
原创 C - 编辑距离
编辑距离,又称Levenshtein距离(也叫做Edit Distance),是指两个字串之间,由一个转成另一个所需的最少编辑操作次数。许可的编辑操作包括将一个字符替换成另一个字符,插入一个字符,删除一个字符。例如将kitten一字转成sitting:sitten (k->s)sittin (e->i)sitting (->g)所以kitten和sitting的编辑距离是3。俄罗斯
2017-07-31 10:26:02 246
原创 换零钱_见解
N元钱换为零钱,有多少不同的换法?币值包括1 2 5分,1 2 5角,1 2 5 10 20 50 100元。例如:5分钱换为零钱,有以下4种换法:1、5个1分2、1个2分3个1分3、2个2分1个1分4、1个5分(由于结果可能会很大,输出Mod 10^9 + 7的结果)Input输入1个数N,N = 100表示1元钱。(1 Output输出Mod 10^9
2017-07-31 09:16:49 519
原创 J - 正整数分组
将一堆正整数分为2组,要求2组的和相差最小。例如:1 2 3 4 5,将1 2 4分为1组,3 5分为1组,两组和相差1,是所有方案中相差最少的。Input第1行:一个数N,N为正整数的数量。 第2 - N+1行,N个正整数。 (N Output输出这个最小差Sample Input512345Sample Output1值
2017-07-30 19:44:02 277
原创 K - 循环数组最大子段和
N个整数组成的循环序列a11,a22,a33,…,ann,求该序列如aii+ai+1i+1+…+ajj的连续的子段和的最大值(循环序列是指n个数围成一个圈,因此需要考虑an−1n−1,ann,a11,a22这样的序列)。当所给的整数均为负数时和为0。例如:-2,11,-4,13,-5,-2,和最大的子段为:11,-4,13。和为20。Input第1行:整数序列的长度N(2 第2
2017-07-29 16:47:49 357
原创 B - 最长递增子序列
给出长度为N的数组,找出这个数组的最长递增子序列。(递增子序列是指,子序列的元素是递增的)例如:5 1 6 8 2 4 5 10,最长递增子序列是1 2 4 5 10。Input第1行:1个数N,N为序列的长度(2 第2 - N + 1行:每行1个数,对应序列的元素(-10^9 ii <= 10^9)Output输出最长递增子序列的长度。Sample Input
2017-07-29 10:06:56 392
原创 H - 图书管理系统
I mean your borrowers of books — those mutilators of collections, spoilers of the symmetryof shelves, and creators of odd volumes. – (Charles Lamb, Essays of E
2017-07-27 17:09:31 395
原创 2017新成员基础练习
A - FatMouse' Trade 该题就是,简单的一个贪心的问题,求最大金额的数目,只需要sort排序就可以了。代码如下: #include<iostream>#include<cstdio>#include<algorithm>#include<cstring>usi...
2017-07-26 15:13:50 316
原创 A - 代码对齐
subject You are working in a team that writes Incredibly Customizable Programming Codewriter (ICPC) whichis basically a text editor with bells and whistles. You are working on a module that tak
2017-07-25 13:03:24 329
原创 k-更新字典
subject In this problem, a dictionary is collection of key-value pairs, where keys are lower-case letters, andvalues are non-negative integers. Given an old dictionary and a new dictionary,
2017-07-25 10:49:43 249
原创 bfs中的队列相关函数
成员函数:empty()判断队列空,当队列空时,返回true。size()访问队列中的元素个数。push()会将一个元素置入queue中。front()会返回queue内的第一个元素(也就是第一个被置入的元素)。back()会返回queue中最后一个元素(也就是最后被插入的元素)。pop()会从queue中移除一个元素。注意: pop()虽然会移
2017-07-24 15:12:41 402
原创 C - 卡片游戏
subjectGiven is an ordered deck of n cardsnumbered 1 to n with card 1 at the top and card n at the bottom. The followingoperation is performed as long as there are at least two cards in the deck:Thr
2017-07-24 15:02:22 786
原创 R - A Minimum Land Price
Subject Managerof ACM-ICPC Thailand Contest Council is planning to buy lands in Phuket tobuild the office building for national programming skill camp and programmingcontest that will be held o
2017-07-23 20:56:36 393
原创 T - 汽油补给
有(N+1)个城市,0是起点N是终点,开车从0 -> 1 - > 2...... -> N,车每走1个单位距离消耗1个单位的汽油,油箱的容量是T。给出每个城市到下一个城市的距离D,以及当地的油价P,求走完整个旅途最少的花费。如果无法从起点到达终点输出-1。例如D = {10, 9, 8}, P = {2, 1, 3},T = 15,最小花费为41,在0加上10个单位的汽油,在1加满15个单位的
2017-07-23 11:07:21 363
原创 U - Radar Installation
Assume the coasting is an infinite straight line. Land is in one side of coasting, sea in the other. Each small island is a point locating in the sea side. And any radar installation, locating on the
2017-07-21 20:42:55 361
转载 D - Cow Acrobats
Farmer John's N (1 <= N <= 50,000) cows (numbered 1..N) are planning to run away and join the circus. Their hoofed feet prevent them from tightrope walking and swinging from the trapeze (and their las
2017-07-21 19:47:51 305
原创 B - 走格子
有编号1-n的n个格子,机器人从1号格子顺序向后走,一直走到n号格子,并需要从n号格子走出去。机器人有一个初始能量,每个格子对应一个整数Aii,表示这个格子的能量值。如果Aii > 0,机器人走到这个格子能够获取Aii个能量,如果Aii < 0,走到这个格子需要消耗相应的能量,如果机器人的能量 < 0,就无法继续前进了。问机器人最少需要有多少初始能量,才能完成整个旅程。例如:n
2017-07-20 15:12:40 359
转载 E - Nightmare
Ignatius had a nightmare last night. He found himself in a labyrinth with a time bomb on him. The labyrinth has an exit, Ignatius should get out of the labyrinth before the bomb explodes. The initial
2017-07-20 11:43:10 264
原创 I - Substrings
You are given a number of case-sensitive strings of alphabetic characters, find the largest string X, such that either X, or its inverse can be found as a substring of any of the given strings.
2017-07-20 11:06:12 249
原创 H - 4个数和为0
给出N个整数,你来判断一下是否能够选出4个数,他们的和为0,可以则输出"Yes",否则输出"No"。Input第1行,1个数N,N为数组的长度(4 第2 - N + 1行:Aii(-10^9 ii <= 10^9)Output如果可以选出4个数,使得他们的和为0,则输出"Yes",否则输出"No"。Sample Input5-11-524Sample
2017-07-19 12:41:43 388
原创 Fair Division
Subject:It’syour friend’s birthday, and you and some other people decided to buy him a copyof StarCraft II, because who wouldn’t want to have that?Youagreed to divide the costs as fairly as poss
2017-07-18 16:50:09 532
原创 K - Supermarket
Mr. Jones is an exemplary husband. Every Saturday morning Mrs. Jones gives him a list of goods to be bought from the supermarket and he buys exactly what he has been asked for, always choosing the bra
2017-07-18 10:22:18 336
原创 A - 无向图最小生成树
N个点M条边的无向连通图,每条边有一个权值,求该图的最小生成树。Input第1行:2个数N,M中间用空格分隔,N为点的数量,M为边的数量。(2 <= N <= 1000, 1 <= M <= 50000) 第2 - M + 1行:每行3个数S E W,分别表示M条边的2个顶点及权值。(1 <= S, E <= N,1 <= W <= 100...
2017-07-16 14:22:53 485
转载 A - Biorhythms
SubjectSome people believe that there are three cycles in a person's life that start the day he or she is born. These three cycles are the physical, emotional, and intellectual cycles, and they have
2017-07-15 17:27:40 298
转载 X - A计划
可怜的公主在一次次被魔王掳走一次次被骑士们救回来之后,而今,不幸的她再一次面临生命的考验。魔王已经发出消息说将在T时刻吃掉公主,因为他听信谣言说吃公主的肉也能长生不老。年迈的国王正是心急如焚,告招天下勇士来拯救公主。不过公主早已习以为常,她深信智勇的骑士LJ肯定能将她救出。 现据密探所报,公主被关在一个两层的迷宫里,迷宫的入口是S(0,0,0),公主的位置用P表示,时空传输机用#表示,墙用*表
2017-07-15 17:19:56 378
原创 D - Color Me Less
A color reduction is a mapping from a set of discrete colors to a smaller one. The solution to this problem requires that you perform just such a mapping in a standard twenty-four bit RGB color space.
2017-07-15 12:10:28 247
原创 E - Round and Round We Go
SubjectA cyclic number is an integer n digits in length which,when multiplied by any integer from 1 to n, yields a"cycle"of thedigits of the original number. That is, if you consider the number afte
2017-07-15 12:01:02 270
原创 Safecracker
DescriptionThe item is locked in a Klein safe behind a painting in the second-floor library. Klein safes are extremely rare; most of them, along with Klein and his factory, were destroyed in World
2017-07-14 17:26:52 257
原创 Y - Fibonacci Again
SubjectThere are another kind of Fibonacci numbers: F(0) = 7,F(1) = 11, F(n) = F(n-1) + F(n-2) (n>=2). *********************************************************************************************
2017-07-14 09:06:22 213
原创 A - Tempter of the Bone
SubjectThe doggie found a bone in an ancient maze, whichfascinated him a lot. However, when he picked it up, the maze began to shake,and the doggie could feel the ground sinking. He realized that th
2017-07-13 21:25:24 277
转载 G - 最少拦截系统
Subject某国为了防御敌国的导弹袭击,发展出一种导弹拦截系统.但是这种导弹拦截系统有一个缺陷:虽然它的第一发炮弹能够到达任意的高度,但是以后每一发炮弹都不能超过前一发的高度.某天,雷达捕捉到敌国的导弹来袭.由于该系统还在试用阶段,所以只有一套系统,因此有可能不能拦截所有的导弹. 怎么办呢?多搞几套系统呗!你说说倒蛮容易,成本呢?成本是个大问题啊.所以俺就到这里来求救了,请帮助计算一下最
2017-07-13 09:59:16 326
原创 N-迷障
通过悬崖的yifenfei,又面临着幽谷的考验—— 幽谷周围瘴气弥漫,静的可怕,隐约可见地上堆满了骷髅。由于此处长年不见天日,导致空气中布满了毒素,一旦吸入体内,便会全身溃烂而死。 幸好yifenfei早有防备,提前备好了解药材料(各种浓度的万能药水)。现在只需按照配置成不同比例的浓度。 现已知yifenfei随身携带有n种浓度的万能药水,体积V都相同,浓度则分别为Pi%。并且
2017-07-13 09:41:14 340
原创 E - Wooden Sticks
SubjectThere is a pile of n wooden sticks. The length and weightof each stick are known in advance. The sticks are to be processed by awoodworking machine in one by one fashion. It needs some time,
2017-07-13 08:32:40 297
原创 D - Moving Tables
Subject:The famous ACM(Advanced Computer Maker) Company has rented a floor of a building whose shapeis in the following figure. The floor has 200 rooms each on the north side and south side a
2017-07-13 08:24:46 318
原创 B - Fire Net
Subject:Suppose that we have a square city with straight streets.A map of a city is a square board with n rows and n columns, each representinga street or a piece of wall. A blockhouse is a smal
2017-07-11 20:08:08 281
原创 L - 悼念512汶川大地震遇难同胞——老人是真饿了
时间:2008年5月16日(震后第4天) 地点:汶川县牛脑寨 人物:羌族老奶奶 【转载整理】牛脑寨是一个全村600多人的羌族寨子,震后几天,这里依然能常常听到隆隆的声音,那是对面山上石头不断滑落的声音。在完成整个突击队的抢修移动基站的任务后,我提着相机开始记录这里的受创情况。 突然,我的视线里出现一个羌族老人,这让我无比的震惊,要知道,那是一个极陡的坡,这个佝偻着腰的老人是怎么
2017-07-11 10:25:46 505
原创 R - Let the Balloon Rise
subjectContest time again! How excited it is to see balloonsfloating around. But to tell you a secret, the judges' favorite time isguessing the most popular problem. When the contest is over, they w
2017-07-11 09:16:46 288
原创 还是A+B
Description读入两个小于10000的正整数A和B,计算A+B。需要注意的是:如果A和B的末尾K(不超过8)位数字相同,请直接输出-1。Input测试输入包含若干测试用例,每个测试用例占一行,格式为"A B K",相邻两数字有一个空格间隔。当A和B同时为0时输入结束,相应的结果不要输出。Output对每个测试用例输出1行,即A+B的值或者是-1。
2017-07-11 08:33:39 215
原创 V - Digital Roots
题目如下:The digital root of a positive integer is found bysumming the digits of the integer. If the resulting value is a single digit thenthat digit is the digital root. If the resulting value contains
2017-07-10 13:19:52 338
Genealogy.zip
2019-09-03
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人