博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
HDU 1495 非常可乐
阅读量:7291 次
发布时间:2019-06-30

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

题目:

#include 
using namespace std;int S,N,M;int vis[110][110]={
0}; int ans ;int min(const int a,const int b){ return a
vis[A][B]) { return ; } vis[A][B] = d; if( A ==S/2 && (A==B||A==C) || (C == S/2 && B==C)) { ans = min(ans,d); } if( A > 0 ) { if(A+B<=N) DFS(d+1,0,A+B,C); else DFS(d+1,A-N+B,N,C); if(A+C<=M) DFS(d+1,0,B,A+C); else DFS(d+1,A-M+C,B,M); } if( B > 0) { if(B+A<=S) DFS(d+1,B+A,0,C); if(B+C<=M) DFS(d+1,A,0,B+C); else DFS(d+1,A,B-M+C,M); } if( C > 0) { if(C+A<=S) DFS(d+1,C+A,B,0); if(C+B<=N) DFS(d+1,A,C+B,0); else DFS(d+1,A,N,C-N+B); }}int main(int argc, const char *argv[]){ while(cin>>S>>N>>M && (S+N+M)>0) { if(N

 

转载于:https://www.cnblogs.com/destino74/p/3333867.html

你可能感兴趣的文章
eclipse中输入的中文为繁体的问题
查看>>
.NET跨平台:在Linux Ubuntu上编译coreclr/corefx/dnx(20150617)
查看>>
[CQOI2016]手机号码
查看>>
Eclipse CDT 配置C /C ++ 标准库 (UBUNTU 12 )
查看>>
面霸吕国栋之:整理的一些面试题
查看>>
转 Python爬虫入门五之URLError异常处理
查看>>
转 Python执行系统命令的方法
查看>>
CSS 折角效果
查看>>
个人作业3---个人总结
查看>>
[分享]ip地址爬取过滤的shell
查看>>
差分数组
查看>>
Shiro 加密helloWorld
查看>>
关于安装sql2012出现的netfx3功能问题
查看>>
基础关3
查看>>
tar 解压缩
查看>>
(转)Sharepoint学习笔记—Debug--寻找 WSS_Logging下的ULSTraceLog
查看>>
数据库命令大全(也不是很全哈)
查看>>
鼠标变小手的方式
查看>>
20111124
查看>>
HierarchyId 与.Net Framework 4.5.3报错
查看>>