1.codeforces 349B    Color the Fence 2.链接:http://codeforces.com/problemset/problem/349/B 3.总结: 刷栅栏.1-9每个字母分别要ai升油漆,问最多可画多大的数字. 贪心,也有点考思维. #include<bits/stdc++.h> using namespace std; #define LL long long #define INF 0x3f3f3f3f int main() { ]; while(…
349B - Color the Fence 贪心 代码: #include<iostream> #include<algorithm> #include<cstdio> #include<cmath> #include<cstring> using namespace std; ; const int INF=0x7f7f7f7f; ]; int main() { int n; int MIN=INF; ; cin>>n; ;i&l…
题目链接:http://codeforces.com/problemset/problem/349/B 题目大意 小明要从9个数字(1,2,--,9)去除一些数字拼接成一个数字,是的这个数字最大. 但是小明每取一个数字i就会消耗a[i]点体力,小明目前总共有v点体力. 举个例子: 小明如果有5点体力,而a[1]到a[9]的数值依次为: 5 4 3 2 1 2 3 4 5 那么最好的办法就是取5次数字5,因为a[5]=1最小,所以最终得到的数字是11111,比起其他的取数策略所得到的数字都要大.…
题意:给出1~9数字对应的费用以及一定的费用,让你输出所选的数字所能组合出的最大的数值. 析:DP,和01背包差不多的,dp[i] 表示费用最大为 i 时,最多多少位,然后再用两个数组,一个记录路径,一个记录是数字几即可. 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000000") #include <cstdio> #include <string> #include <cstdlib>…
题目描述: D. Color the Fence time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Igor has fallen in love with Tanya. Now Igor wants to show his feelings and write a number on the fence opposite to…
Color the Fence Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Description Igor has fallen in love with Tanya. Now Igor wants to show his feelings and write a number on the fence opposite to Tanya's house.…
题目链接:http://codeforces.com/problemset/problem/349/B 题目意思:给定v升的颜料和9个需要花费ad 升的颜料,花费ad 升的颜料意味着得到第d个数字,现在要求在所有的花费不超过v升的情况下,使得这些数字组合起来是最大的. 一开始直接从最小花费的颜料着手,如果花费的颜料是相同的,就转到从d(也就是位数)最大贪心.这样测试9就开始卡住了. 受到乌冬兄的指点迷津,终于有了思路,陆陆续续改了很多次,终于过了.以下摘自他的语录,白话文,大家请谅解: 稳用颜料…
Color the fence 时间限制:1000 ms  |  内存限制:65535 KB 难度:2   描述 Tom has fallen in love with Mary. Now Tom wants to show his love and write a number on the fence opposite to Mary's house. Tom thinks that the larger the numbers is, the more chance to win Mary…
Color the fence 时间限制:1000 ms  |  内存限制:65535 KB 难度:2   描述 Tom has fallen in love with Mary. Now Tom wants to show his love and write a number on the fence opposite to Mary’s house. Tom thinks that the larger the numbers is, the more chance to win Mary…
Color the fence 时间限制:1000 ms  |  内存限制:65535 KB 难度:2   描述 Tom has fallen in love with Mary. Now Tom wants to show his love and write a number on the fence opposite to Mary’s house. Tom thinks that the larger the numbers is, the more chance to win Mary…