- 博客(211)
- 资源 (2)
- 收藏
- 关注
原创 2017 ACM-ICPC 亚洲区(西安赛区)网络赛 E. Maximum Flow
Given a directed graph with nn nodes, labeled 0,1, \cdots, n-10,1,⋯,n−1.For each satisfies 0 \le i Find the maximum flow network from the 0-th node to the (n-1)-th node, modulo 100000000710000000
2017-09-16 23:59:26
1514
原创 滴滴出行 地下迷宫
题目描述小青蛙有一天不小心落入了一个地下迷宫,小青蛙希望用自己仅剩的体力值P跳出这个地下迷宫。为了让问题简单,假设这是一个n*m的格子迷宫,迷宫每个位置为0或者1,0代表这个位置有障碍物,小青蛙达到不了这个位置;1代表小青蛙可以达到的位置。小青蛙初始在(0,0)位置,地下迷宫的出口在(0,m-1)(保证这两个位置都是1,并且保证一定有起点到终点可达的路径),小青蛙在迷宫中水平移动一个单位距离需
2017-09-02 09:00:56
805
原创 滴滴出行 餐馆
题目描述某餐馆有n张桌子,每张桌子有一个参数:a 可容纳的最大人数; 有m批客人,每批客人有两个参数:b人数,c预计消费金额。 在不允许拼桌的情况下,请实现一个算法选择其中一部分客人,使得总预计消费金额最大#include #include #include #include # define f(i,m,n) for(int i=m; i<=n; i++)# define sf
2017-09-01 21:10:28
607
原创 异或(今日头条2017秋招真题)
题目描述给定整数m以及n个数字A1, A2, …, An,将数列A中所有元素两两异或,共能得到n(n-1)/2个结果。请求出这些结果中大于m的有多少个。输入第一行包含两个整数n, m。第二行给出n个整数A1, A2, …, An。输出输出仅包括一行,即所求的答案。样例输入3 106 5 10样例输出2解题思路:正解就是用字典树,如果不懂的话,
2017-08-28 10:42:49
776
原创 任务列表(360公司2017春招真题)
题目描述现在现在有一台机器,这台机器可以接收两种形式任务:(1)任务列表,任务列表里面有N个任务,对于第i个任务,机器在Ti时间开始执行,并在1个单位时间内做完。(2)临时任务,机器可以在任意时间接收一个临时任务,但任务列表里面的任务优先级要高于临时任务,也就是说当机器空闲的时候才会执行临时任务。现在机器已经接收一个任务列表。接下来会有M个临时任务,我们想知道每个临时任务何时被执行。为
2017-08-25 16:12:35
973
原创 内存管理(3602017秋招真题)
题目描述 物联网技术的蓬勃发展,各种传感器纷纷出现。小B所在的项目组正在开发一个物联网项目,她们在研究设计一种新的传感器。这种传感器有自己的基本处理单元,具有一定的自主性,能够进行简单的数据收集、处理、存储和传输。为降低系统功耗并保证系统可靠性和可控性,他们要对内存进行基本的管理。研究小组计划开发一个实验性内存管理器,实现对内存的分配、释放和整理。对应的接口为new、del和def,使用语法为
2017-08-25 15:30:36
1269
2
原创 分金子(360公司2017春招真题)
题目描述A、B两伙马贼意外地在一片沙漠中发现了一处金矿,双方都想独占金矿,但各自的实力都不足以吞下对方,经过谈判后,双方同意用一个公平的方式来处理这片金矿。处理的规则如下:他们把整个金矿分成n段,由A、B开始轮流从最左端或最右端占据一段,直到分完为止。马贼A想提前知道他们能分到多少金子,因此请你帮忙计算他们最后各自拥有多少金子?(两伙马贼均会采取对己方有利的策略)输入测试数据
2017-08-23 16:33:03
1202
原创 电话号码分身(小米2017秋招真题)
题目描述继MIUI8推出手机分身功能之后,MIUI9计划推出一个电话号码分身的功能:首先将电话号码中的每个数字加上8取个位,然后使用对应的大写字母代替("ZERO", "ONE", "TWO", "THREE", "FOUR","FIVE", "SIX", "SEVEN", "EIGHT", "NINE"),然后随机打乱这些字母,所生成的字符串即为电话号码对应的分身。输入
2017-08-23 13:10:10
2258
1
原创 2018网易校招内推编程题 小易喜欢的数列(动态规划)
小易非常喜欢拥有以下性质的数列:1、数列的长度为n2、数列中的每个数都在1到k之间(包括1和k)3、对于位置相邻的两个数A和B(A在B前),都满足(A 例如,当n = 4, k = 7那么{1,7,7,2},它的长度是4,所有数字也在1到7范围内,并且满足第三条性质,所以小易是喜欢这个数列的但是小易不喜欢{4,4,4,2}这个数列。小易给出n和k,希望你能帮他求出有多少个是
2017-08-16 15:32:44
2846
原创 2018网易内推编程题 疯狂队列
小易老师是非常严厉的,它会要求所有学生在进入教室前都排成一列,并且他要求学生按照身高不递减的顺序排列。有一次,n个学生在列队的时候,小易老师正好去卫生间了。学生们终于有机会反击了,于是学生们决定来一次疯狂的队列,他们定义一个队列的疯狂值为每对相邻排列学生身高差的绝对值总和。由于按照身高顺序排列的队列的疯狂值是最小的,他们当然决定按照疯狂值最大的顺序来进行列队。现在给出n个学生的身高,请计算出这些学
2017-08-14 09:28:50
1428
原创 2018网易校招内推编程题 堆棋子
小易将n个棋子摆放在一张无限大的棋盘上。第i个棋子放在第x[i]行y[i]列。同一个格子允许放置多个棋子。每一次操作小易可以把一个棋子拿起并将其移动到原格子的上、下、左、右的任意一个格子中。小易想知道要让棋盘上出现有一个格子中至少有i(1 ≤ i ≤ n)个棋子所需要的最少操作次数.输入描述:输入包括三行,第一行一个整数n(1 ≤ n ≤ 50),表示棋子的个数第二行为n个棋子的横
2017-08-13 16:56:19
2379
原创 网易2018校招内退编程题 独立的小易
小易为了向他的父母表现他已经长大独立了,他决定搬出去自己居住一段时间。一个人生活增加了许多花费: 小易每天必须吃一个水果并且需要每天支付x元的房屋租金。当前小易手中已经有f个水果和d元钱,小易也能去商店购买一些水果,商店每个水果售卖p元。小易为了表现他独立生活的能力,希望能独立生活的时间越长越好,小易希望你来帮他计算一下他最多能独立生活多少天。输入描述:输入包括一行,四个整数x, f,
2017-08-13 14:14:42
1213
原创 有趣的排序
度度熊有一个N个数的数组,他想将数组从小到大 排好序,但是萌萌的度度熊只会下面这个操作:任取数组中的一个数然后将它放置在数组的最后一个位置。问最少操作多少次可以使得数组从小到大有序?输入描述:首先输入一个正整数N,接下来的一行输入N个整数。(N 输出描述:输出一个整数表示最少的操作次数。输入例子1:419 7 8 25输出例子1:2结题
2017-08-09 23:47:01
406
原创 最大乘积
给定一个无序数组,包含正数、负数和0,要求从中找出3个数的乘积,使得乘积最大输入描述:无序整数数组A[n]输出描述:满足条件的最大乘积思路:这个可以分类讨论下(1)三个数都是整数,找最大的三个正数(2)两个正数一个负数,最小的两个正数和最大的一个负数(3)一个正数两个负数,最小的两个负数,和最大的一个正数(4)三个都是负数,找最大的三个负数(
2017-08-07 12:43:13
891
原创 Lintcode 买卖股票的最佳时机 II
连接:http://www.lintcode.com/zh-cn/problem/best-time-to-buy-and-sell-stock-ii/假设有一个数组,它的第i个元素是一个给定的股票在第i天的价格。设计一个算法来找到最大的利润。你可以完成尽可能多的交易(多次买卖股票)。然而,你不能同时参与多个交易(你必须在再次购买前出售股票)。这一题很容易想到一个n方的
2017-06-06 21:11:50
734
原创 codeforce 796C - Bank Hacking(无根树+思维)
Although Inzane successfully found his beloved bone, Zane, his owner, has yet to return. To search for Zane, he would need a lot of money, of which he sadly has none. To deal with the problem, he has
2017-04-14 18:31:23
1006
原创 codeforce 761E - Dasha and Puzzle(思维)
Dasha decided to have a rest after solving the problem. She had been ready to start her favourite activity — origami, but remembered the puzzle that she could not solve.The tree is a non-oriented
2017-04-12 20:56:20
573
原创 HDU 2224The shortest path(dp)
Problem DescriptionThere are n points on the plane, Pi(xi, yi)(1 <= i <= n), and xi < xj (i<j). You begin at P1 and visit all points then back to P1. But there is a constraint:Before you reach t
2017-04-09 13:29:15
551
原创 codeforce 792C - Divide by Three(思维)
A positive integer numbernis written on a blackboard. It consists of not more than105digits. You have to transform it into abeautifulnumber by erasing some of the digits, and you want to erase
2017-04-04 13:52:47
1023
原创 codeforces 776E - The Holmes Children
The Holmes children are fighting over who amongst them is the cleverest.Mycroft asked Sherlock and Eurus to find value off(n), wheref(1) = 1and forn ≥ 2,f(n)is the number of distinct ord
2017-04-03 12:11:20
1156
原创 codeforce 613B - Skills(二分+贪心)
Lesha plays the recently published new version of the legendary game hacknet. In this version character skill mechanism was introduced. Now, each player character has exactlynskills. Each skill is
2017-03-11 23:13:22
451
原创 codeforces 768C - Jon Snow and his Favourite Number
Jon Snow now has to fight with White Walkers. He hasnrangers, each of which has his own strength. Also Jon Snow has his favourite numberx. Each ranger can fight with a white walker only if the st
2017-03-07 23:04:23
50979
原创 codeforce 776 D The Door Problem(DFS遍历)
D. The Door Problemtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputMoriarty has trappednpeople inndist
2017-03-06 19:09:28
491
原创 codeforces 777E Hanoi Factory
Of course you have heard the famous task about Hanoi Towers, but did you know that there is a special factory producing the rings for this wonderful game? Once upon a time, the ruler of the ancient Eg
2017-02-28 08:42:12
541
原创 777D - Cloud of Hashtags
D. Cloud of Hashtagstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputVasya is an administrator of a public
2017-02-26 11:30:23
494
原创 codeforce 6C - Alice, Bob and Chocolate
Alice and Bob like games. And now they are ready to start a new game. They have placednchocolate bars in a line. Alice starts to eat chocolate bars one by one from left to right, and Bob — from ri
2017-01-17 20:40:25
639
原创 codeforce B. Bash Big Day
Bash has set out on a journey to become the greatest Pokemon master. To get his first Pokemon, he went to Professor Zulu's Lab. Since Bash is Professor Zulu's favourite student, Zulu allows him to tak
2017-01-17 19:21:15
565
原创 D. Least Cost Bracket Sequence
D. Least Cost Bracket Sequencetime limit per test1 secondmemory limit per test64 megabytesinputstandard inputoutputstandard outputThis is yet another problem on regular bracket sequences.A
2017-01-13 14:18:28
499
原创 codeforce 386(div2) D. Green and Black Tea
Innokentiy likes tea very much and today he wants to drink exactlyncups of tea. He would be happy to drink more but he had exactlyntea bags,aof them are green andbare black.Innokentiy
2017-01-09 11:25:10
413
原创 codeforces 730J - Bottles
Nick has n bottles of soda left after his birthday. Each bottle is described by two values: remaining amount of soda ai and bottle volume bi (ai ≤ bi).Nick has decided to pour all remaining soda int
2017-01-04 23:23:16
856
原创 NYOJ 括号匹配(二)(区间dp)
描述 给你一个字符串,里面只包含"(",")","[","]"四种符号,请问你需要至少添加多少个括号才能使这些括号匹配起来。 如: []是匹配的 ([])[]是匹配的 ((]是不匹配的 ([)]是不匹配的输入 第一行输入一个正整数N,表示测试数据组数(N 每组测试数据都只有一行,是一个字符串S,S中只包含以上所说的
2016-12-31 17:02:53
424
原创 HDU 1533Going Home(费用流)
Going HomeTime Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 4797 Accepted Submission(s): 2512Problem DescriptionOn a grid map ther
2016-12-31 11:12:21
344
原创 codeforces 742B - Arpa’s obvious problem and Mehrdad’s terrible solution
B. Arpa’s obvious problem and Mehrdad’s terrible solutiontime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputTh
2016-12-14 20:59:39
452
原创 codeforces 735B - Urbanization
Local authorities have heard a lot about combinatorial abilities of Ostap Bender so they decided to ask his help in the question of urbanization. There are n people who plan to move to the cities. The
2016-12-04 10:53:58
448
原创 FOJ Problem 2218 Simple String Problem
Problem DescriptionRecently, you have found your interest in string theory. Here is an interesting question about strings.You are given a string S of length n consisting of the first k lowercase
2016-12-03 23:58:29
488
原创 蓝桥网 格子刷油漆
X国的一段古城墙的顶端可以看成 2*N个格子组成的矩形(如下图所示),现需要把这些格子刷上保护漆。你可以从任意一个格子刷起,刷完一格,可以移动到和它相邻的格子(对角相邻也算数),但不能移动到较远的格子(因为油漆未干不能踩!) 比如:a d b c e f 就是合格的刷漆顺序。 c e f d a b 是另一种合适的方案。 当已知 N 时,求总的方案数。当N较大
2016-12-01 13:04:39
388
原创 蓝桥网 历届试题 九宫重排
问题描述 如下面第一个图的九宫格中,放着 1~8 的数字卡片,还有一个格子空着。与空格子相邻的格子中的卡片可以移动到空格中。经过若干次移动,可以形成第二个图所示的局面。我们把第一个图的局面记为:12345678. 把第二个图的局面记为:123.46758 显然是按从上到下,从左到右的顺序记录数字,空格记为句点。 本题目的任务是已知九宫的初态和终态,求最少经过多少
2016-11-30 12:35:44
435
原创 codeforces 733B - Parade
Very soon there will be a parade of victory over alien invaders in Berland. Unfortunately, all soldiers died in the war and now the army consists of entirely new recruits, many of whom do not even kno
2016-11-27 22:29:39
493
原创 codeforces D. Exams
Vasiliy has an exam period which will continue for n days. He has to pass exams on m subjects. Subjects are numbered from 1 to m.About every day we know exam for which one of m subjects can be passe
2016-11-24 20:54:42
438
原创 codeforces C. Buns
Lavrenty, a baker, is going to make several buns with stuffings and sell them.Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lav
2016-11-17 22:37:08
486
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人