URAL 1780 G - Gray Code 找规律】的更多相关文章

G - Gray CodeTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=87643#problem/G Description Denis, Vanya and Fedya gathered at their first team training. Fedya told them that he knew the algorithm for c…
把一对石子堆看出一个子游戏.打出子游戏的sg表找规律.. 这个规律我是一定找不出来的... 对于i,j,如果 (i-1)%pow(2,k+1) < pow(2,k) (j-1)%pow(2,k+1) < pow(2,k) 那么最小的k值就是sg值.   # include <cstdio> # include <cstring> # include <cstdlib> # include <iostream> # include <vect…
链接:https://www.nowcoder.com/acm/contest/135/G来源:牛客网 题目描述 从前,Apojacsleam家的水族箱里,养了一群热带鱼. 在这几条热带鱼里,Apojacsleam特别喜欢一条叫做TbGx(请勿人肉)的热带鱼,所以每次都让她第一个吃食物.对于每一条鱼,Apojacsleam都有一个顺序,鱼会按照这个顺序排序,越靠前的地位越高. 吃饱喝足是要睡觉的,这是人的刚需,也是鱼的刚需. 如果TbGx吃了Apojacsleam的食物,她就会睡觉(睡觉时长远小…
Code Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 7913   Accepted: 3709 Description Transmitting and memorizing information is a task that requires different coding systems for the best use of the available space. A well known system…
先手动推出前10项,再上BM板子求出递推式 $A_n = 5A_{n-1} - 10A_{n-2} + 10A_{n-3} - 5A_{n-4} + A_{n-5}$,根据特征根理论可求出特征方程 $(x-1)^5$,设 $A_n = k_1n^4 + k_2n^3 + k_3n^2+k_4n+k_5$,代入前5项求出系数(用了高斯消元法解方程组). 这样虽然做出来了,但是感觉比较浪费时间,因为BM板子和高斯消元法的板子都不短,对手残狗不友好. 说明一下,差分法只能针对递推式的通项是对n的多项式…
原题链接:http://acm.timus.ru/problem.aspx?space=1&num=1780 1780. Gray Code Time limit: 0.5 secondMemory limit: 64 MB Denis, Vanya and Fedya gathered at their first team training. Fedya told them that he knew the algorithm for constructing aGray code. Cre…
题目链接: https://www.nowcoder.com/acm/contest/135/g 题目描述 从前,Apojacsleam家的水族箱里,养了一群热带鱼. 在这几条热带鱼里,Apojacsleam特别喜欢一条叫做TbGx(请勿人肉)的热带鱼,所以每次都让她第一个吃食物.对于每一条鱼,Apojacsleam都有一个顺序,鱼会按照这个顺序排序,越靠前的地位越高. 吃饱喝足是要睡觉的,这是人的刚需,也是鱼的刚需. 如果TbGx吃了Apojacsleam的食物,她就会睡觉(睡觉时长远小于一天…
题目链接:https://nanti.jisuanke.com/t/31716 题目大意:有n个孩子和n个糖果,现在让n个孩子排成一列,一个一个发糖果,每个孩子随机挑选x个糖果给他,x>=1,直到无糖果剩余为止.给出数字n,问有多少种分发糖果的方法. 样例输入 复制 1 4 样例输出 复制 8 解题思路:我们可以这样想,一个糖果的话,应该是只有1种方法记为x1,如果是两个糖果的话,有两种方法即为x2,分别为(1,1)和(2),从中我们可以想到如果n个糖果的话,就可以分为第n个人取1个的话就有x(…
2045. Richness of words 题目连接: http://acm.timus.ru/problem.aspx?space=1&num=2045 Description For each integer i from 1 to n, you must print a string si of length n consisting of lowercase Latin letters. The string si must contain exactly i distinct pa…
2037. Richness of binary words 题目连接: http://acm.timus.ru/problem.aspx?space=1&num=2037 Description For each integer i from 1 to n, you must print a string si of length n consisting of letters 'a' and 'b' only. The string si must contain exactly i dis…