HDU - 6130 Kolakoski (打表)】的更多相关文章

题意:由1,2,2,1,1,2,1,2,2,1,2,2,1,1,2,1,1,2,2,1,……合并可得1,22,11,2,1,22,1,22,11,2,11,22,1,再由每个数的位数可得新序列,推出新序列第n项. 分析:新序列与原序列相同,按题意打表即可. #include<cstdio> #include<cstring> #include<cstdlib> #include<cctype> #include<cmath> #include&l…
Kolakoski 思路: 从前往后扩展,前后构成映射关系. 代码: #include<bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define mem(a,b) memset((a),(b),sizeof(a)) ; ,,,}; int main() { ios::sync_with_stdio(false); cin.tie(); ; ,j=; while(j<N) {…
hdu 1496 Equations hash表 题目链接 http://acm.hdu.edu.cn/showproblem.php?pid=1496 思路: hash表,将原来\(n^{4}\)降为\(n^{2}\) 关系式:\(a*{x{}_1}^{2}+b*{x{}_2}^{2}=-c*{x{}_3}^{2}-d*{x{}_4}^{2}\) 详见hdu课件:https://wenku.baidu.com/view/af87677fa76e58fafab003e5.html 代码: #in…
http://acm.hdu.edu.cn/showproblem.php?pid=5104 找元组数量,满足p1<=p2<=p3且p1+p2+p3=n且都是素数 不用素数打表都能过,数据弱的一比 #include <cstdio> #include <cstdlib> #include <cmath> #include <cstring> #include <string> #include <queue> #inclu…
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5976 Detachment Time Limit: 4000/2000 MS (Java/Others)Memory Limit: 65536/65536 K (Java/Others) 问题描述 In a highly developed alien society, the habitats are almost infinite dimensional space. In the histo…
题目: http://acm.hdu.edu.cn/showproblem.php?pid=5289 Assignment Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 3175    Accepted Submission(s): 1457 Problem Description Tom owns a company and he i…
链接:http://acm.hdu.edu.cn/showproblem.php?pid=6253 题意: 马可以往一个方向走两步,然后转个弯走一步,这样算一次动作,求问马n次动作后,能到达多少个点,重复到达的点只算一次. 思路: 一开始完全没思路,画图找了半天把自己画崩了,后面看到数据和样例感觉这应该是一道公式题,然后打了一个表.. 打表代码: #include<bits/stdc++.h> using namespace std; #define ull unsigned long lon…
普通NIM规则加上一条可以分解为两堆,标准的Multi-SG游戏 一般Multi-SG就是根据拓扑图计算SG函数,这题打表后还能发现规律 sg(1)=1 sg(2)=2 sg(3)=mex{0,1,2,1^2}=4 sg(4)=mex{0,1,2,sg(3)}=3 可以发现3和4的时候相当于互换了位置 /** @Date : 2017-10-12 21:20:21 * @FileName: HDU 3032 博弈 SG函数找规律.cpp * @Platform: Windows * @Autho…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4707 解题报告:题目大意是在无向图G中有n个点,分别从0 到n-1编号,然后在这些点之间有n-1条边,可以保证这个图是连通图,并且每条边的长度都是1,然后让你求出从编号为0的点出发,到其它的点的距离大于d的点的个数. 这题的点的个数有500000个,而内存限制为32M,很显然,开邻接矩阵不行,但这题实际上不需要记录边只需要开一位数组就可以了,但是我为了练习一下邻接矩阵的写法,特地用邻接矩阵另外写了一…
Largest prime factor Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 8976    Accepted Submission(s): 3191 Problem Description Everybody knows any number can be combined by the prime number. Now…