poj 3134 Power Calculus iddfs(迭代深搜)
来源:互联网 发布:淘宝达人官方 编辑:程序博客网 时间:2024/05/17 01:32
iddfs入门题。
//poj 3134//sep9#include <iostream>using namespace std;int n,deep;int a[30];bool iddfs(int pos){int t;if(pos>deep) return false;if(a[pos]<<(deep-pos)<n) return false;if(a[pos]==n)return true;for(int i=1;i<=pos;++i){a[pos+1]=a[i]+a[pos];if(a[pos]+1<=3000&&iddfs(pos+1)==true) return true;a[pos+1]=a[pos]-a[i];if(a[pos]+1>0&&iddfs(pos+1)==true) return true;}return false;}int main(){while(scanf("%d",&n)==1&&n){deep=1,a[1]=1;while(iddfs(1)==0) ++deep;printf("%d\n",deep-1);}return 0;}
0 0
- poj 3134 Power Calculus iddfs(迭代深搜)
- POJ 3134 - Power Calculus (IDDFS)
- IDDFS--UVA - 1374 Power Calculus
- POJ 3134 - Power Calculus
- Power Calculus(POJ 3134)
- poj 3134 Power Calculus(IDA*)
- poj 3134 Power Calculus (IDA*)
- POJ 3134Power Calculus(IDA*)
- POJ 3134 Power Calculus (IDA*)
- poj 3134Power Calculus (IDAstar)
- POJ 3134 Power Calculus 笔记
- poj 3134 Power Calculus (IDA*)
- POJ 3134 - Power Calculus 迭代加深搜索(DFSID)
- poj 3134 Power Calculus(迭代加深dfs)
- poj 3134 Power Calculus(迭代加深dfs)
- POJ-3134-Power Calculus(迭代加深DFS)
- LA 3621 / POJ 3134 Power Calculus (迭代加深搜索)
- POJ 3134 Power Calculus 迭代加深搜索
- solrCloud选举时间缩短的方法当一个leader挂掉后,其中的几个replica要重新选一个
- 浅谈常用数据库方式连接之ADO和ODBC
- 联想y430p win8.1 解决qq语音 qq视频卡死 yy卡死 等录音软件卡死问题
- C语言基础知识 梳理总结
- There is no Action mapped for namespace [/] and action name [Login] associated wi
- poj 3134 Power Calculus iddfs(迭代深搜)
- 关于logAnalyzer
- linux系统开机顺序
- android ViewPager,ViewFlipper,ViewFlow实现左右滑动
- Android开发之数据库SQLite 详细介绍
- 如何使用gcore工具获取一个core文件而不重启应用?
- 求函数的根
- extends 继承问题
- Java Socket实战之三:传输对象