Problem Description Chiaki is interested in an infinite sequence a1,a2,a3,..., which is defined as follows: an={1an−an−1+an−1−an−2n=1,2n≥3 Chiaki would like to know the sum of the first n terms of the sequence, i.e. ∑i=1nai. As this number may be ver…
题目链接 Problem Description Chiaki is interested in an infinite sequence $$$a_1,a_2,a_3,...,$$$ which is defined as follows: $$$a_n= \begin{cases} 1, & \text{$$$n=1,2$$$} \\ a_{n-a_{n-1}}+a_{n-1-a_{n-2}} & \text{$$$n\ge 3$$$} \end{cases}$$$ Chiaki wo…
题目链接 : http://acm.hdu.edu.cn/showproblem.php?pid=6304 多校contest1   Problem Description Chiaki is interested in an infinite sequence a1,a2,a3,..., which is defined as follows: an={1an−an−1+an−1−an−2n=1,2n≥3 Chiaki would like to know the sum of the fir…
http://acm.hdu.edu.cn/showproblem.php?pid=6304 题意 给出一个数列的定义,a[1]=a[2]=1,a[n]=a[n-a[n-1]]+a[n-1-a[n-2]](n>=3).求前n项和,n<=1e18. 分析 一看就是得打表找规律或推公式的题目. 先把a[i]打出来: 1 1 2 2 3 4 4 4 5 6 6... 乍眼一看每个数字出现的次数有点意思,于是打出每个数出现次数: 数值   1  2  3  4  5  6  7  8  9  10 …
题意:给定一个序列a,定义a[1]=a[2]=1,a[n]=a[n-a[n-1]]+a[n-1-a[n-2]](n>=3),求该序列的前n项和是多少,结果对 1e9+7 取模 n<=1e18 思路:OEIS没通项,打表找规律 除第一个1之外 1 3 5 7出现了1次 2 6 10 14出现了2次 4 12 20 28出现了3次 8 24 40 56出现了4次 先算出最多出现次数,然后对于出现次数相同的数用等差数列求和 余下的暴力计算 队友lyy写的 #include<cstdio>…
[HDU6304][数学] Chiaki Sequence Revisited -杭电多校2018第一场G 题目描述 现在抛给你一个数列\(A\) \[ a_n=\begin{cases}1 & n = 1,2 \\ a_{n - a_{n-1}} + a_{n-1 - a_{n-2}} & n \ge 3\end{cases} \] 现在需要你计算它的前缀和 \(\sum\limits_{i=1}^{n}a_i \ mod \ (10^9+7)\) 数据范围 \(n(1\le n\le…
题目 第一次做是看了大牛的找规律结果,如下: //显然我看了答案,循环节点是48,但是为什么是48,据说是高手打表出来的 #include<stdio.h> int main() { ],a,b,i,n; f[]=;f[]=; while(scanf("%d%d%d",&a,&b,&n)!=EOF) { &&b==&&n==)break; ;i<;i++) { f[i]=(a*f[i-])%+(b*f[i-])%…
Long long ago, there is a sequence A with length n. All numbers in this sequence is no smaller than 1 and no bigger than n, and all numbers are different in this sequence. Please calculate how many quad (a,b,c,d) satisfy: 1. 1≤a<b<c<d≤n1≤a<b&l…
找单词 Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3722    Accepted Submission(s): 2663 Problem Description 假设有x1个字母A, x2个字母B,..... x26个字母Z,同时假设字母A的价值为1,字母B的价值为2,..... 字母Z的价值为26.那么,对于给定的字母,可以找到…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5064 题目意思:给出n个数:a1, a2, ..., an,然后需要从中找出一个最长的序列 b1, b2, ...,  bt.需要满足两个条件(1)b1≤b2≤…≤bt   (2)b2−b1≤b3−b2≤⋯≤bt−bt−1.求出最大的 t 为多少. 遗留大半年的题目呀呀呀呀~~~~!!!首先非常感谢乌冬子大半年前的指点迷津,呕心沥血想了大半天举出个反例,以便指出我算法的错误.为了纪念这个伟大的人物(…