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 …
题目链接 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…
题意:给定一个序列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>…
题目链接 : 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…
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…
[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…
Problem Description Today, Soda has learned a sequence whose n-th (n≥) item )+. Now he wants to know if an integer m can be represented as the sum of some items of that sequence. If possible, what are the minimum items needed? For example, =+++=+++.…
 Infinite Sequence Crawling in process... Crawling failed Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Practice CodeForces 622A Description Consider the infinite sequence of integers: 1, 1, 2, 1, 2, 3,…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5312 Sequence Time Limit: 2000/2000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others) Total Submission(s): 1336    Accepted Submission(s): 410 Problem Description Today, Soda has learned a…
C. Sequence Transformation:http://codeforces.com/contest/1059/problem/C 题意 给你一个n,第一次输出1-n个数的gcd,然后你可以任意删除1-n中的数字,然后输出剩下n-1个数的gcd,再删一个数...,最后就是输出n个gcd值对吧. 要求输出的数列字典序最大. 思路 首先对于一个n,为了使得数列字典序最大,肯定是越早输出2越好,所以前面先把所有的奇数去掉,前(n+1)/2 个数肯定也就是1,那么剩下的偶数呢,可以先对这些偶…