# -*- coding:utf-8 -*-
import sys
import re
def main():
t =True;
while t:
ss = raw_input("");
s=[]
s= re.findall("\d+",ss)
if int(s[0])<1:
if int(s[1])!=0:
print "error"
else:
if int(s[1])==0:
t=False;
print "to the end"
if int(s[1])>1000:
print "error"
if int(s[2])!=0:
if int(s[2])<1 or int(s[2])>100000000:
print "error"
what=[1,1];
for i in range(2,int(s[2])):
what.append((int(s[0])*what[i-1]+int(s[1])*what[i-2])%7)
print what[int(s[2])-1]
if __name__ == '__main__':
main()
HDU 1005 Number Sequence python实现
最新推荐文章于 2020-12-04 10:49:13 发布