杭电 ACM 小弟想知道为什么循环周期是49 呢,A number sequence is defined as fol
来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/05/12 01:34:22
杭电 ACM
小弟想知道为什么循环周期是49 呢,
A number sequence is defined as follows:
f(1) = 1,f(2) = 1,f(n) = (A * f(n - 1) + B * f(n - 2)) mod 7.
Given A,B,and n,you are to calculate the value of f(n).
Input
The input consists of multiple test cases.Each test case contains 3 integers A,B and n on a single line (1
小弟想知道为什么循环周期是49 呢,
A number sequence is defined as follows:
f(1) = 1,f(2) = 1,f(n) = (A * f(n - 1) + B * f(n - 2)) mod 7.
Given A,B,and n,you are to calculate the value of f(n).
Input
The input consists of multiple test cases.Each test case contains 3 integers A,B and n on a single line (1
首先 这是一个数列,也就是一系列的数,这个是句废话,但是必须得说
其次,除了f1 和f2以外,每个数字都由前两个数字决定,这个是公式确定的
也就是说,如果对于数列f1 f2 ..fa fb .fc fd 存在fa=fc且fd=fb 那么后续的一定循环
第三,对于任意的fn,由于是mod 7所以其取值只能是0 1 2 3 4 5 6这7种可能
这样对于任意的连续两个数字,fa fb,可能的组合就是7*7=49种,而实际上,0,0序列是一个特殊的情况,除非A B都是7的倍数,那么所有序列都是0,不然是不会出现00的可能的.
所以,如果提取一个长为50的任意子序列,可以提取出49个连续对,这49个中肯定会有至少一个重复,也就是循环周期了
这个循环周期
其次,除了f1 和f2以外,每个数字都由前两个数字决定,这个是公式确定的
也就是说,如果对于数列f1 f2 ..fa fb .fc fd 存在fa=fc且fd=fb 那么后续的一定循环
第三,对于任意的fn,由于是mod 7所以其取值只能是0 1 2 3 4 5 6这7种可能
这样对于任意的连续两个数字,fa fb,可能的组合就是7*7=49种,而实际上,0,0序列是一个特殊的情况,除非A B都是7的倍数,那么所有序列都是0,不然是不会出现00的可能的.
所以,如果提取一个长为50的任意子序列,可以提取出49个连续对,这49个中肯定会有至少一个重复,也就是循环周期了
这个循环周期
杭电 ACM 小弟想知道为什么循环周期是49 呢,A number sequence is defined as fol
为什么杭电acm1005周期是49呢
英语翻译这句子是The n(th) term of a number sequence is given by form
杭电1005,为什么周期是49?
英语翻译BOP-days,is defined as the number of days from the BOP w
Number Sequence
a sequence of number is like this:2,5,9,14,20,27...then the
杭电acm 1008 题我的为什么是wrong answer
为什么杭电acm 1013结果就是mod9的余数,
What is the next number in this sequence?
杭电ACM problem 1002 A + B Problem II
英语翻译Trust is defined as ‘‘the willingness of a party to be v