摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=2553经典的N皇后问题。在N*N的方格棋盘放置了N个皇后,使得它们不相互攻击(即任意2个皇后不允许处在同一排,同一列,也不允许处在与棋盘边框成45角的斜线上。你的任务是,对于给定的N,求出有多少种合法的放置方法。直接dfs。#include <cstdio>#include <cstring>#include <iostream>#include <algorithm>#include <vector>#include <set>#inc 阅读全文
posted @ 2013-03-28 23:42
aiiYuu
阅读(132)
评论(0)
推荐(0)
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=1016题目大意:找不所有第一个数是1,相邻两数之和是素数的n元环。直接dfs。#include <cstdio>#include <cstring>#include <iostream>#include <algorithm>#include <vector>#include <set>#include <map>#include <cmath>#include <queue>using namespa 阅读全文
posted @ 2013-03-28 23:40
aiiYuu
阅读(171)
评论(0)
推荐(0)
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=1312题目大意:求所有不经过红格能到达的黑格的个数。直接dfs搜索。#include <cstdio>#include <cstring>#include <iostream>#include <algorithm>#include <vector>#include <set>#include <map>#include <cmath>#include <queue>using namespace st 阅读全文
posted @ 2013-03-28 23:37
aiiYuu
阅读(135)
评论(0)
推荐(0)
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=2952题目大意:问图上有几堆羊。直接dfs搜索。#include <cstdio>#include <cstring>#include <iostream>#include <algorithm>#include <vector>#include <set>#include <map>#include <cmath>#include <queue>using namespace std;template 阅读全文
posted @ 2013-03-28 23:34
aiiYuu
阅读(137)
评论(0)
推荐(0)
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=1213题目大意:给出一些关系,求有几个集合。“OneimportantruleforthisproblemisthatifItellyouAknowsB,andBknowsC,thatmeansA,B,Cknoweachother,sotheycanstayinonetable.”并查集裸体,直接上代码:#include <cstdio>#include <cstring>#include <iostream>#include <algorithm>#inclu 阅读全文
posted @ 2013-03-28 23:30
aiiYuu
阅读(136)
评论(0)
推荐(0)
摘要:
MCPC2011Hdu4207-4214(未完全)题解第一题:GradeSchoolMultiplicationhttp://acm.hdu.edu.cn/showproblem.php?pid=4207题目大意:给你两个数,要求按照题目所讲的规律一步步得出结果。如:给你两个数432和5678,你就要按照下面的规律输出4325678-------3456302425922160-------2452896模拟。因为数据范围不是很大,所以直接用longlong型计算每一位然后输出结果就行。注意:特别要注意0的情况,因为没有考虑这种情况导致了多次wa。代码:#include <cstdio& 阅读全文
posted @ 2013-03-28 04:16
aiiYuu
阅读(242)
评论(0)
推荐(0)

浙公网安备 33010602011771号