An Orz panda find a very interesting problem. His problem is that x + y = A, x * y = B, where A and B are constant, how to calculate x2 + y2, x3 + y3 , …… xn + yn . Panda wants you to help him solve it. If you can solve it successfully, he’ll summon many small pandas to Orz you.
In this problem, you just need calculate the result of xn + yn . Since the result can be very large, determine the remainder after dividing it by 1000000007.
1115: Equation of Orz Pandas
时间限制: 1 Sec 内存限制: 128 MB提交: 112 解决: 29
[提交][状态][讨论版]
题目描述
输入
There several test cases, process to EOF, about 200 test cases.
For each test case, one line contains three A, B, n.
0 ≤ A, B ≤ 1000000, 1 ≤ n ≤ 10000.
输出
Print a single integer modulo1000000007.
样例输入
3 2 2
样例输出
5
提示
来源
한국어
中文
فارسی
English
ไทย
Anything about the Problems, Please Contact Admin:admin
All Copyright Reserved 2010-2019 Xidian Programming Contest Online Judge TEAM
GPL2.0 2003-2014 HUSTOJ Project TEAM
Anything about the Problems, Please Contact Admin:admin
All Copyright Reserved 2010-2019 Xidian Programming Contest Online Judge TEAM
GPL2.0 2003-2014 HUSTOJ Project TEAM