Hdu-6253 2017CCPC-Final K.Knightmare 规律】的更多相关文章

题面 题意:给你一个无限大的棋盘,一个象棋中的马,问你这个马,飞n步后,可能的位置有多少种? 题解:看到题,就想先打表试试,于是先写个暴力(枚举每个位置,是马就飞周围8个格子,注意不要在同个循环里把格子的标记涂成相同的数字) 然后打出来是9 41 109 205 325 473 649 853 对于这种增长不快的,我一般是先直接两项相减 得到 32 68  96  120 148 176 204 这时就看到,这个数列的增长越来越有趣? 后面都加的是? 于是对于n>=5,我们有 f[n]=f[n-…
普通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…
题目链接 Problem Description Function Fx,ysatisfies: For given integers N and M,calculate Fm,1 modulo 1e9+7. Input There is one integer T in the first line. The next T lines,each line includes two integers N and M . 1<=T<=10000,1<=N,M<2^63. Output…
题目链接 题意:一个马在无限大的棋盘中跳,问跳n步能跳到多少个不同的格子. 首先写个打表程序打一下n比较小的时候的表: #include<bits/stdc++.h> using namespace std; typedef long long ll; +,mod=; ,-,,,,,-,-}; ,-,-,-,,,,}; typedef pair<int,int> P; ]; ,a[N]; int main() { st[].insert({,}); ; i<n; ++i) {…
题目链接: 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=4662 题意: 初始字符串为"MI". 有三个操作: (1)将'M'之后的所有字符翻倍.For example: MIU to MIUIU. (2)将'III'变为一个'U'.For example: MUIIIU to MUUU. (3)删除'UU'.For example: MUUU to MU 给你一个字符串s,问你是否能将初始字符串"MI"通过一系列操作变为s.…
月之数 Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 10273    Accepted Submission(s): 6003 Problem Description 当寒月还在读大一的时候,他在一本武林秘籍中(据后来考证,估计是计算机基础,狂汗-ing),发现了神奇的二进制数. 如果一个正整数m表示成二进制,它的位数为n(不包含前…
题目链接 :http://acm.hdu.edu.cn/showproblem.php?pid=6030 Problem Description Little Q wants to buy a necklace for his girlfriend. Necklaces are single strings composed of multiple red and blue beads. Little Q desperately wants to impress his girlfriend,…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1030 Delta-wave Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 7163    Accepted Submission(s): 2772 Problem Description A triangle field is numbe…
http://acm.hdu.edu.cn/showproblem.php?pid=5102 给一棵树,求出所有节点的距离中前k小的路径长度和 由于路径长度的定义为两点之间的边的个数,所有遍历1~n-1条边组成的路径,暴力擦线过,3000+ms #include <cstdio> #include <cstdlib> #include <cmath> #include <cstring> #include <string> #include &l…