Pebbles(hdu2167)】的更多相关文章

Pebbles Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 1393    Accepted Submission(s): 797 Problem Description You're given an unlimited number of pebbles to distribute across an N x N game boa…
题目给一张n×n的格子,每个格子都有数字,要从格子中取若干个数字,八个方向相邻的数字不能一起取,问取的数字最大和是多少. 从第一行一行一行看下去,可以发现第1行取哪几列只会影响到第2行,第3行后面的一点影响都没有.即第i行的决策只受i-1行决策的影响. 那么自然想到状态DP—— dp[i][S]前i行其中第i行取的列的集合是S的取数最大和 dp[i][S]=max(dp[i-1][S'])+集合S数字和(S是S'的合法的下一行的取法) 虽然题目n最多15,集合S就215种状态,但事实上合法的(不…
来自FallDream的博客,未经允许,请勿转载,谢谢. 给定一个方阵,你要取出一些数字,满足没有两个格子八联通相邻的前提下和最大,求这个和 n<=15 插头dp,保存轮廓线以及目前转移点左上方那个格子的状态,枚举格子转移即可. #include<iostream> #include<cstdio> #include<cstring> #define MN 15 using namespace std; inline int read() { , f = ; ch…
题目链接:http://codeforces.com/problemset/problem/509/B 题目意思:有 n 个piles,第 i 个 piles有 ai 个pebbles,用 k 种颜色去填充所有存在的pebbles,使得任意两个piles,用颜色c填充的pebbles数量之差 <= 1.如果不填充某种颜色,就默认数量为0. 这样说还是比较难理解吧---以第三组数据为例: 5 43 2 4 3 5 YES1 2 31 31 2 3 41 3 41 1 2 3 4 第2个 pile…
题目传送门 /* 题意:有 n 个piles,第 i 个 piles有 ai 个pebbles,用 k 种颜色去填充所有存在的pebbles, 使得任意两个piles,用颜色c填充的pebbles数量之差 <= 1. 如果不填充某种颜色,就默认数量为0. 1. 贪心:如果个数之间超过k个,那么填充什么颜色都会大于1,巧妙地思维 详细解释:http://blog.csdn.net/haoliang94/article/details/43672617 2. 比较每种填充颜色在n组里使用最多和最少的…
Pebbles Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 689    Accepted Submission(s): 373 Problem DescriptionYou're given an unlimited number of pebbles to distribute across an N x N game board…
Separating Pebbles 题目链接: http://acm.hust.edu.cn/vjudge/contest/127401#problem/H Description http://7xjob4.com1.z0.glb.clouddn.com/1e1638de1146450534631815cbf822c6 Input The first line of the input contains an integer K (K ≤ 20) indicating the number…
B. Painting Pebbles time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output There are n piles of pebbles on the table, the i-th pile contains ai pebbles. Your task is to paint each pebble using one…
1982: [Spoj 2021]Moving Pebbles Time Limit: 10 Sec  Memory Limit: 64 MBSubmit: 130  Solved: 88[Submit][Status][Discuss] Description 2021. Moving Pebbles Two players play the following game. At the beginning of the game they start with n (1<=n<=10000…
B. Painting Pebbles time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output There are n piles of pebbles on the table, the i-th pile contains ai pebbles. Your task is to paint each pebble using one…