poj 1945 Power Hungry Cows 启发式搜索
来源:互联网 发布:2017中超守门员数据 编辑:程序博客网 时间:2024/06/05 20:31
这个题目用了启发式搜索来做,hash判重,优先队列储存节点。启发式函数就是大的数字x*2^k>n,即为k。
x为节点中较大值,y为节点中较小值
然后后面就是一些剪枝了,当x>2*n不能得出最优解。当y==0,不能得出最优解。当x==y,不能得出最优解。
还有一个比较关键的剪枝,gcd(x,y)不能整除n时,得不出结果。
#include
#include
#include
#include
#include
using namespace std;
const int maxn=160000+10;
int n;
int d[22222];
int time;
struct node
{
};
priority_queue que;
int hash[maxn],lon;
struct
{
}data[11111111];
void insert(struct node *p)
{
}
int gcd(int a,int b)
{
}
int check(int x,int y,int h)
{
}
int cal(int x,int y)
{
}
void work(int x,int y,int h)
{
}
int bfs()
{
}
int main()
{
}
- poj 1945 Power Hungry Cows 启发式搜索
- POJ 1945 Power Hungry Cows
- POJ 1945 Power Hungry Cows 我的解法
- POJ 1945 Power Hungry Cows(打表技巧)
- poj 1945 Power Hungry Cows(BFS)(简单题)
- TOJ 1551 Power Hungry Cows -- 搜索
- 【BFS搜索】poj1945 Power Hungry Cows
- POJ1945 Power Hungry Cows (BFS)
- poj1945 Power Hungry Cows BFS
- 【启发式搜索】[POJ 1077]Eight
- bzoj1669 Hungry Cows
- POJ 2243 Knight Moves(启发式搜索)
- 【图论】【启发式搜索】[POJ 2449]Remmarguts' Date
- 启发式搜索
- 启发式搜索
- 启发式搜索
- 启发式搜索
- 启发式搜索
- poj 3661 Running dp(动态规划)
- poj 3659 Cell Phone Network 贪心
- poj 2409 Let it Bead
- poj 3662 Telephone Lines 图论
- poj 1944 模拟 枚举
- poj 1945 Power Hungry Cows 启发式搜索
- Scala学习记录(一)
- poj 1948 Triangular Pastures dp
- poj 1949 Chores
- poj 1950 Desser dfs
- poj 2189 Romeo Meet juliet 枚举
- Codeforces Round #178 组合数学
- Oracle常用傻瓜问题1000问
- poj 1185 炮兵阵地 状态压缩dp