作业帮 > 综合 > 作业

Number Sequence

来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/07/08 07:30:53
Number Sequence
Time Limit:2000/1000 MS (Java/Others) Memory Limit:65536/32768 K (Java/Others)
Total Submission(s):8030 Accepted Submission(s):1482
Problem Description
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
计算有时间限制 2000/1000 毫秒
1