摘要:
题意:给定一个数k,求包含k在内的连续非素数序列的长度。思路:水..........题目链接:http://poj.org/problem?id=3518View Code 1 #include <cstdio> 2 #include <cstring> 3 #include <cstdlib> 4 #include <cmath> 5 #include <string> 6 #include <algorithm> 7 #include <iostream> 8 using namespace std; 9 阅读全文
摘要:
题意:给定一个数n,找出连续n个素数相加等于这个数的种数。思路:水.......题目链接:http://poj.org/problem?id=2739View Code 1 #include <cstdio> 2 #include <cstring> 3 #include <cstdlib> 4 #include <cmath> 5 #include <string> 6 #include <algorithm> 7 #include <iostream> 8 using namespace std; 9 co 阅读全文
摘要:
题意:一个规则的实心十二面体,它的 20个顶点标出世界著名的20个城市,你从一个城市出发经过每个城市刚好一次后回到出发的城市,给出每一个点相邻的点,求每一个序列。思路:dfs.题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2181View Code 1 #include <cstdio> 2 #include <cstring> 3 #include <cstdlib> 4 #include <cmath> 5 #include <string> 6 #include <algor 阅读全文
摘要:
题意:给出n*n的矩阵、代表两点之间的距离,给出k个乘客和乘客要下的站点,起点在0,求从起点到每个站点的最短距离。思路:dfs找出最短距离即可.题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1572View Code 1 #include <cstdio> 2 #include <cstring> 3 #include <cstdlib> 4 #include <cmath> 5 #include <string> 6 #include <algorithm> 7 #incl 阅读全文
摘要:
题意:给出三个数n,m,d,求n到m间满足相邻2~d个数的和是非素数的序列。思路:dfs。题目链接:http://poj.org/problem?id=2034View Code 1 #include <cstdio> 2 #include <cstring> 3 #include <cstdlib> 4 #include <cmath> 5 #include <string> 6 #include <algorithm> 7 #include <iostream> 8 using namespace std; 阅读全文
摘要:
题意:已知任意一个大于1的数可以表示成一些素数的乘积,即x=p1^e1*p2^e2……pn^en (pi 为素数,ei 为对应素数的个数),现给你x的表示,要你求x-1的表示。例:输入:5 1 2 1 则x=5^1*2^1=10,所以x-1=9,9可以表示成:9=3^2 输出:3 2思路:打出素数表、然后从小到大除即可。题目链接:http://poj.org/problem?id=1365View Code 1 #include <cstdio> 2 #include <cstring> 3 #include <cstdlib> 4 #include < 阅读全文
摘要:
题意:给出sum和n个数,找出满足m(m<=n)个数相加等于sum。思路:dfs.题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1258View Code 1 #include <cstdio> 2 #include <cstring> 3 #include <cstdlib> 4 #include <cmath> 5 #include <string> 6 #include <algorithm> 7 #include <iostream> 8 using 阅读全文
摘要:
题意:给出n个单词,判断是否存在以‘b’开头,‘m’结尾的情况。思路:dfs.题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1181View Code 1 #include <cstdio> 2 #include <cstring> 3 #include <cstdlib> 4 #include <cmath> 5 #include <string> 6 #include <algorithm> 7 #include <iostream> 8 using name 阅读全文
摘要:
1.burnside定理,polya计数法 这个大家可以看brudildi的《组合数学》,那本书的这一章写的很详细也很容易理解。最好能完全看懂了,理解了再去做题,不要只记个公式。 *简单题:(直接用套公式就可以了) pku2409 Let it Bead http://acm.pku.edu.cn/JudgeOnline/problem?id=2409 pku2154 Color http://acm.pku.edu.cn/JudgeOnline/problem?id=2409 pku1286 Necklace of Beads ... 阅读全文