随笔分类 - 数论 - 组合数学
摘要:Recently, TeaTree acquire new knoledge gcd (Greatest Common Divisor), now she want to test you. As we know, TeaTree is a tree and her root is node 1,
阅读全文
摘要:链接:https://www.nowcoder.com/acm/contest/148/D来源:牛客网题目描述Prefix Sum is a useful trick in data structure problems.For example, given an array A of length
阅读全文
摘要:链接:https://www.nowcoder.com/acm/contest/144/C来源:牛客网 题目描述 Oak is given N empty and non-repeatable sets which are numbered from 1 to N. Now Oak is going
阅读全文
摘要:链接:https://www.nowcoder.com/acm/contest/129/A来源:牛客网 有一个长度为n的序列a,已知a[1]=a[n]=1,且对于2 <= x <= n,a[x] / a[x-1]是以下三个数字之一 [ 1,-2,0.5 ],问有多少种不同的序列满足题意。 两个序列不
阅读全文
摘要:链接:https://www.nowcoder.com/acm/contest/109/C来源:牛客网 题目描述 给定长度为n的数组a,定义一次操作为: 1. 算出长度为n的数组s,使得si= (a[1] + a[2] + ... + a[i]) mod 1,000,000,007; 2. 执行a
阅读全文
摘要:给定n个数a1,a2····an,依次求出相邻两个数值和,将得到一个新数列,重复上述操作,最后结果将变为一个数,问这个数除以m的余数与那些数无关?例如n=3,m=2时,第一次得到a1+a2,a2+a3,在求和得到a1+2*a2+a3,它除以2的余数和a2无关。1=<n<=10^5, 2=<m<=10
阅读全文