{ 数论 }hdoj1005
来源:互联网 发布:php 遍历对象属性 编辑:程序博客网 时间:2024/05/24 02:35
Number Sequence
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 83940 Accepted Submission(s): 19891
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).
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 <= A, B <= 1000, 1 <= n <= 100,000,000). Three zeros signal the end of input and this test case is not to be processed.
Output
For each test case, print the value of f(n) on a single line.
Sample Input
1 1 31 2 100 0 0
Sample Output
25
- { 数论 }hdoj1005
- HDOJ1005 Number Sequence(数论水题)
- HDOJ1005
- hdoj1005
- hdoj1005
- hdoj1005
- hdoj1005
- HDOJ1005
- hdoj1005
- hdoj1005
- hdoj1005
- HDOJ1005
- hdoj1005-java
- HDOJ1005 Number Sequence
- 循环节(hdoj1005)
- HDOJ1005:Number Sequence
- hdoj1005解题报告
- HDOJ1005 Number Sequence
- linux-2.6.26内核中ARM中断实现详解(1)
- linux下的TCP小程序
- 阿里dba-exam
- 将数组里面偶数和奇数分区
- NYOJ 486题 Old Calculator
- { 数论 }hdoj1005
- Java学习笔记——一切都是对象
- hibernate基础操作
- Linux数据管理——文件锁定
- Spring MVC 注解开发备忘录
- 摘录:给linux新手的学习建议
- 博弈类题目小结(HDU,POJ,ZOJ)
- 高清儿童视频,歌曲早教软件 小孩教育学习的好工具 首发
- C语言实现定积分求解方法