HDU 2616 Kill the monster
来源:互联网 发布:俄罗斯女孩中国人知乎 编辑:程序博客网 时间:2024/05/21 18:39
数据太弱,dfs水过。。
#include <iostream>#include <cstdio>#include <cstring>#include <algorithm>#include <cmath>#include <vector>#include <map>#include <queue>#include <ctime>#include <set>#define ll long long#define MK make_pair#define PB push_back#define SZ(x) ((int)(x).size())#define FOR(it,c) for ( __typeof((c).begin()) it=(c).begin(); it!=(c).end(); it++ )using namespace std;int n,m,a[15],b[15],ans;bool vis[15];void dfs(int d,int mon){ if(mon<=0){ if(ans==-1||ans>d) ans=d; return; } for(int i=0;i<n;i++){ if(vis[i]) continue; vis[i]=true; if(mon<=b[i]) dfs(d+1,mon-2*a[i]); else dfs(d+1,mon-a[i]); vis[i]=false; }}int main(){#ifndef ONLINE_JUDGE freopen("a.in","r",stdin); freopen("a.out","w",stdout);#endif while(cin>>n>>m){ for(int i=0;i<n;i++) cin>>a[i]>>b[i]; ans=-1; dfs(0,m); cout<<ans<<endl; } return 0;}
- hdu 2616 Kill the monster
- HDU 2616 Kill the monster
- HDU 2616 Kill the monster
- hdu(2616)Kill the monster
- HDU 2616 Kill the monster
- hdu 2616 Kill the monster
- HDU-2616-Kill the monster
- HDU 2616 Kill the monster
- hdu 2616 Kill the monster(深搜)
- hdu 2616 Kill the monster(DFS)
- hdu 2616 Kill the monster(暴搜)
- 【DFS】hdu 2616 Kill the monster
- HDU 2616 Kill the monster 简单DFS
- hdu 2616 Kill the monster(dfs)
- 杭电ACM HDU 2616 Kill the monster
- hdu 2616 Kill the monster(简单回溯搜索)
- HDU 2616 Kill the monster (深搜DFS)
- 杭电 2616 Kill the monster
- Exchange Server 2013存档技术
- mysql 之 exists子查询
- SQLServer2008镜像实施过程摘要和碰到的问题
- PMOS开关管的选择与电路图
- ASP.NET GridView 实现课程表显示(动态合并单元格)
- HDU 2616 Kill the monster
- webrtc关于锁的编程思想
- 模拟编译器对虚函数索引项的实现
- javascript解析json数据-简单演示
- 每天读一遍,不久你就会变!
- 物联网实验室建设专家
- Comparable和Compara
- 获取硬盘 序列号 信息
- [Boost基础]并发编程——Thread多线程(三)