?? problem 2105.htm
字號:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0047)http://acm.zju.edu.cn/show_problem.php?pid=2105 -->
<HTML><HEAD><TITLE>Problem 2105</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content="MSHTML 6.00.2900.3157" name=GENERATOR></HEAD>
<BODY>
<CENTER><IMG src="Problem 2105.files/logo.gif" align=center></IMG></CENTER>
<HR>
<CENTER><FONT color=blue size=+2>Number Sequence</FONT></CENTER>
<HR>
<CENTER><FONT color=green>Time limit:</FONT> 1 Seconds <FONT
color=green>Memory limit: </FONT>32768K </FONT><BR><FONT
color=green>Total Submit:</FONT> 5561 <FONT color=green>Accepted
Submit:</FONT> 1194 </CENTER>
<HR>
<P>A number sequence is defined as follows:<BR><BR>f(1) = 1, f(2) = 1, f(n) = (A
* f(n - 1) + B * f(n - 2)) mod 7.<BR><BR>Given A, B, and n, you are to calculate
the value of f(n).</P>
<P><BR><B>Input</B><BR><BR>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.</P>
<P><BR><B>Output</B><BR><BR>For each test case, print the value of f(n) on a
single line. </P>
<P><BR><B>Sample Input</B><BR><BR>1 1 3<BR>1 2 10<BR>0 0 0</P>
<P><BR><B>Sample Output</B><BR><BR>2<BR>5</P>
<P><BR><B>Author: </B><I>CHEN, Shunbao</I><BR></P>
<HR>
<FONT color=green size=+1>Problem Source: </FONT><I>Zhejiang Provincial
Programming Contest 2004</I>
<HR>
<CENTER><A href="http://acm.zju.edu.cn/submit.php?pid=2105">Submit</A>
<A href="http://acm.zju.edu.cn/list_problem.php?vol=12">Back</A>
<A
href="http://acm.zju.edu.cn/problem_status.php?pid=2105">Status</A> </CENTER>
<HR>
<CENTER>
<TABLE width="100%" border=0>
<TBODY>
<TR>
<TD align=right width="65%"><A href="http://acm.zju.edu.cn/"><FONT
color=red>Zhejiang University Online Judge</FONT></A> <A
href="http://acm.zju.edu.cn/"><FONT color=red>V1.0</FONT></A></TD>
<TD align=right width="35%"><A href="http://www.zzhang.cn/"><FONT
color=#ffffff
size=-3>Book</FONT></A></TD></TR></TBODY></TABLE></CENTER></BODY></HTML>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -