搜索
hanker99
这个作者很懒,什么都没留下…
展开
-
UVA 1374 Power Calculus 迭代加深
给出 n,问至少需要计算几步得到 x^n每次总使用最新得到的那个数字即a[d]进行搜索#include<cstdio>#include <algorithm>using namespace std;int a[30],n;bool dfs(int d,int maxd){ if(a[d]==n) return true; if(d==m...原创 2019-01-14 23:22:55 · 102 阅读 · 0 评论 -
UVA 1343 The Rotation Game IDA*
使用IDA*的思想解题, 主要的难点在于如何模拟Rotate操作,以及在检查终点和启发函数时检测中心的8个方格数字是否相同#include <cstdio>#include <algorithm>using namespace std;/* 方格编号 00 01 02 0304 05 06 07 08 09 10 ...原创 2019-01-14 17:33:03 · 119 阅读 · 0 评论 -
UVA 12325 Zombie's Treasure Chest 分类枚举算法
所给数据在int范围内 单独使用其中一种枚举算法都会导致TLE#include<cstdio>#include<algorithm>using namespace std;typedef long long LL;int main(){ int T; scanf("%d", &T); for(int kase = 1; kase &l...原创 2019-01-04 15:31:14 · 122 阅读 · 0 评论 -
UVA11212 编辑书稿 IDA*
#include <cstdio>#include <cstring>using namespace std;const int maxn=9;int n,a[maxn];bool is_sorted(){ for(int i=0;i<n-1;i++) if(a[i]+1!=a[i+1]) return false; ...原创 2019-01-02 20:03:49 · 225 阅读 · 0 评论 -
HDU1584 DFS 蜘蛛牌
#include<cstdio>#include<iostream>#include<algorithm>#include<cstring>using namespace std;int ans,value[15],pos[15],visit[15];void dfs(int level,int dis){ int ...原创 2018-11-25 23:50:16 · 101 阅读 · 0 评论 -
POJ3126 搜索
#include <iostream>#include <queue>#include<cstring>using namespace std;#define MAX_N 9999 + 16int prime[MAX_N]; // 第i个素数bool is_prime[MAX_N + 1]; //is_prime[i]为真的时候表示i...原创 2019-03-04 08:31:59 · 189 阅读 · 0 评论 -
CF999E Reachability from the Capital dfs graph greedy
There arencities andmmroads in Berland. Each road connects a pair of cities. The roads in Berland are one-way.What is the minimum number of new roads that need to be built to make all the cities...原创 2019-05-08 23:11:52 · 288 阅读 · 0 评论