Codeforces Round #256 (Div. 2) C. Painting Fence(分治贪心)...
分类:
其他好文 时间:
2014-07-19 23:25:08
阅读次数:
320
有n(n>=1&&n1&&node[i]>n) { node[0]=0; for(i=1;i>node[i]; inheap(node[i]); } __int64 ans=0; for(i=1;i...
分类:
其他好文 时间:
2014-07-19 23:02:20
阅读次数:
190
解题报告
给篱笆上色,要求步骤最少,篱笆怎么上色应该懂吧,,,刷子可以在横着和竖着刷,不能跳着刷,,,
如果是竖着刷,应当是篱笆的条数,横着刷的话,就是刷完最短木板的长度,再接着考虑没有刷的木板,,,
递归调用,,,
#include
#include
#include
#include
#define inf 999999999999999
using namespace std...
分类:
其他好文 时间:
2014-07-19 12:04:21
阅读次数:
314
题目:codeforces 448CPainting Fence
题意:n个1* a [ i ] 的木板,把他们立起来,变成每个木板宽为1长为 a [ i ] 的栅栏,现在要给栅栏刷漆,刷子宽1,每一刷子可以刷任意长,现在让你求最少需要多少刷子?
分析:题目看似没有头绪,仔细分析的话其实很简单
首先,我们假如每次都刷一个木板,即一竖行,那么需要n次刷完,可见这是一个a...
分类:
其他好文 时间:
2014-07-19 02:35:45
阅读次数:
184
Fence RepairTime Limit: 2000 MS Memory Limit: 65536 KB64-bit integer IO format: %I64d , %I64u Java class name: Main[Submit] [Status] [Discuss]Descript...
分类:
其他好文 时间:
2014-07-19 00:20:15
阅读次数:
183
分治!首先是一大块,贪行刷和竖刷的最小,再转化为小块。。。。。。。。。。。。
AC代码如下:
#include
#include
#include
using namespace std;
int n;
int a[5005];
int solve(int l,int r)
{
int i,j;
int len=r-l+1;
...
分类:
其他好文 时间:
2014-07-18 11:22:29
阅读次数:
229
Fence Repair
Time Limit: 2000MS
Memory Limit: 65536K
Total Submissions: 25274
Accepted: 8131
Description
Farmer John wants to repair a small length of the fence aro...
分类:
其他好文 时间:
2014-07-18 11:11:11
阅读次数:
241
C. Painting FenceBizon the Champion isn't just attentive, he also is very hardworking.Bizon the Champion decided to paint his old fence his favorite c...
分类:
其他好文 时间:
2014-07-18 10:14:51
阅读次数:
268
篱笆修理(Fence Repair) 代码(C)本文地址: http://blog.csdn.net/caroline_wendy题目: 把一块木板切成N块, 每次切两块, 切割的开销是木板长度, 求将木板切割完的最小开销.贪心算法, 类似二叉树型结构, 最短板和次短板是兄弟结点, 选取两个最小木板, 最后进行切割, 合并两个最小木板, 依次递推.代码:/*
* main.cpp
*
*...
分类:
其他好文 时间:
2014-07-17 19:38:57
阅读次数:
267
Fence LoopsThe fences that surround Farmer Brown's collection of pastures have gotten out of control. They are made up of straight segments from 1 thr...
分类:
其他好文 时间:
2014-07-16 19:06:02
阅读次数:
516