随笔分类 - DP
摘要:/*****(一)将n划分成若干不同整数之和的划分数************ dp[i][j]表示将整数i划分成不超过j的划分数,分含不含j两种情况 dp[0][0] = 1 dp[i][j] = dp[i-j][j-1] + dp[i][j-1];(j<=i) = dp[i][i] (j >i)
阅读全文
摘要:题意 :给一棵n个节点的树, 节点编号为1~n, 每条边都有一个花费值. 有k个机器人从S点出发, 问让机器人遍历所有边,最少花费值多少? 这题最难的地方应该就是如何定义状态了 定义dp[u][i]表示遍历完以u为根的子树的所有边时 使用i个机器人并且这i个机器人都不回到u的最小代价 注意一点 有一
阅读全文
摘要:Description Given a map of islands and bridges that connect these islands, a Hamilton path, as we all know, is a path along the bridges such that it v
阅读全文
摘要:链接:https://www.nowcoder.com/acm/contest/140/A来源:牛客网 题目描述 White Cloud is exercising in the playground. White Cloud can walk 1 meters or run k meters pe
阅读全文
摘要:A balanced number is a non-negative integer that can be balanced if a pivot is placed at some digit. More specifically, imagine each digit as a box wi
阅读全文
摘要:windy定义了一种windy数。不含前导零且相邻两个数字之差至少为2的正整数被称为windy数。 windy想知道,在A和B之间,包括A和B,总共有多少个windy数? Input 包含两个整数,A B。 Output 一个整数 Sample Input【输入样例一】 1 10 【输入样例二】 2
阅读全文
摘要:Here is a function f(x): int f ( int x ) { if ( x == 0 ) return 0; return f ( x / 10 ) + x % 10; } Now, you want to know, in a given interval [A, B] (
阅读全文
摘要:A wqb-number, or B-number for short, is a non-negative integer whose decimal form contains the sub- string "13" and can be divided by 13. For example,
阅读全文
摘要:杭州人称那些傻乎乎粘嗒嗒的人为62(音:laoer)。 杭州交通管理局经常会扩充一些的士车牌照,新近出来一个好消息,以后上牌照,不再含有不吉利的数字了,这样一来,就可以消除个别的士司机和乘客的心理障碍,更安全地服务大众。 不吉利的数字为所有含有4或62的号码。例如: 62315 73418 8891
阅读全文
摘要:Squares and rectangles fascinated the famous Dutch painter Piet Mondriaan. One night, after producing the drawings in his 'toilet series' (where he ha
阅读全文
摘要:司令部的将军们打算在N*M的网格地图上部署他们的炮兵部队。一个N*M的地图由N行M列组成,地图的每一格可能是山地(用"H" 表示),也可能是平原(用"P"表示),如下图。在每一格平原地形上最多可以布置一支炮兵部队(山地上不能够部署炮兵部队);一支炮兵部队在地图上的攻击范围如图中黑色区域所示: 如果在
阅读全文
摘要:Farmer John has purchased a lush new rectangular pasture composed of M by N (1 ≤ M ≤ 12; 1 ≤ N≤ 12) square parcels. He wants to grow some yummy corn f
阅读全文
摘要:Z国的骑士团是一个很有势力的组织,帮会中汇聚了来自各地的精英。他们劫富济贫,惩恶扬善,受到社会各界的赞扬。最近发生了一件可怕的事情,邪恶的Y国发动了一场针对Z国的侵略战争。战火绵延五百里,在和平环境中安逸了数百年的Z国又怎能抵挡的住Y国的军队。于是人们把所有的希望都寄托在了骑士团的身上,就像期待有一
阅读全文
摘要:After Farmer John realized that Bessie had installed a "tree-shaped" network among his N (1 <= N <= 10,000) barns at an incredible cost, he sued Bessi
阅读全文
摘要:Bob enjoys playing computer games, especially strategic games, but sometimes he cannot find the solution fast enough and then he is very sad. Now he h
阅读全文
摘要:There is going to be a party to celebrate the 80-th Anniversary of the Ural State University. The University has a hierarchical structure of employees
阅读全文
摘要:D. XOR-pyramid time limit per test 2 seconds memory limit per test 512 megabytes input standard input output standard output For an array bb of length
阅读全文
摘要:The Dwarves of Middle Earth are renowned for their delving and smithy ability, but they are also master builders. During the time of the dragons, the
阅读全文
摘要:Help Jimmy" 是在下图所示的场景上完成的游戏。 场景中包括多个长度和高度各不相同的平台。地面是最低的平台,高度为零,长度无限。 Jimmy老鼠在时刻0从高于所有平台的某处开始下落,它的下落速度始终为1米/秒。当Jimmy落到某个平台上时,游戏者选择让它向左还是向右跑,它跑动的速度也是1米/
阅读全文
摘要:In 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
阅读全文

浙公网安备 33010602011771号