博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
POJ 1873
阅读量:4350 次
发布时间:2019-06-07

本文共 965 字,大约阅读时间需要 3 分钟。

按位枚举,按最小价值,最小砍掉树剪枝就好了。

#include 
#include
#include
#include
#include
using namespace std;const int MAXN=20;const int inf=190000000;int n,l;int st[MAXN],stop,cnt;int ans[MAXN];bool cut[MAXN];struct point{ int x,y; int len,val; int num;}p[MAXN];int ansV,ansC;double anslen;bool cmp(point A,point B){ if(A.y
1&&multi(p[st[stop-1]],p[i],p[st[stop-2]])) stop--; st[stop++]=i; } for(int i=0;i
=0;i--){ if(!cut[i]){ st[stop++]=i; choice++; } if(choice==2){ be=i; break; } } for(int i=be-1;i>=0;i--){ if(cut[i]) continue; while(stop>1&&multi(p[st[stop-1]],p[i],p[st[stop-2]])) stop--; st[stop++]=i; } for(int i=0;i
tmpC){ slove(); double res=for_len(); if(res<=len){ CUT=tmpC; ansV=tmpV; ansC=i; anslen=len*1.0-res; } } } } printf("Forest %d\n",cas); printf("Cut these trees:"); cnt=0; for(int k=0;k

  

转载于:https://www.cnblogs.com/jie-dcai/p/3883609.html

你可能感兴趣的文章
【nosql实现企业网站系列之一】mongodb的安装
查看>>
短信服务供应商价格总览
查看>>
获取本机IP(考虑多块网卡、虚拟机等复杂情况)
查看>>
笔记之_java整理ORM框架
查看>>
CentOS下安装python3.x版本
查看>>
CAP定理(原则)以及BASE理论
查看>>
「玩转树莓派」搭建属于自己的云盘服务
查看>>
有道语料库爬虫
查看>>
VS2019 实用设置
查看>>
for循环语句之求和,阶乘,求偶,求n次篮球蹦起高度
查看>>
CFileDialog
查看>>
[转载]EXTJS学习
查看>>
SQL Server2012完全备份、差异备份、事务日志备份和还原操作
查看>>
Flash动画播放
查看>>
springmvc+mybatis+dubbo+zookeeper 分布式架构
查看>>
HDUOJ-----Computer Transformation
查看>>
HDUOJ-----2838Cow Sorting(组合树状数组)
查看>>
自定义控件之---抽屉式弹窗控件.
查看>>
一款纯css3实现的机器人看书动画效果
查看>>
加班与效率
查看>>